Skip to content

New Type of Resource Provider Adding the Idea of Resource Locators#22

Merged
ZarehD merged 6 commits intoZarehD:masterfrom
Stekeblad:another-way
Dec 31, 2025
Merged

New Type of Resource Provider Adding the Idea of Resource Locators#22
ZarehD merged 6 commits intoZarehD:masterfrom
Stekeblad:another-way

Conversation

@Stekeblad
Copy link
Contributor

This pull request adds two new projects to the solution:

  • Sample.Stekeblad.PartialStaticSite: A sample project showing of the other new project,
  • AspNetStaticContrib.Stekeblad

Contrib.Stekeblad adds a new resource provider, LocatingStaticResourcesInfoProvider that derives from StaticResourcesInfoProvider. It introduces support for adding any number of "Resource locators" to the provider.

Resource locators is a feature added in the new project that package consumers can implement to in a dynamic way find and list content in their application using any registered services and features. The ability to use services was previously limited.

This PR also includes two Resource Locators:

There is also a small fix to the newly added processStartSignal that corrects an issue where it could lock the entire application until signalTimeoutSeconds had elapsed.

…vider (LocatingStaticResourcesInfoProvider) and introduces the idea of Resource locators as a more dymaic option for adding resources.
…f Samples.PartialStaticSite and modified to show off AspNetStaticContrib.Stekeblad
@ZarehD
Copy link
Owner

ZarehD commented Dec 31, 2025

Good work, @Stekeblad!

Some questions and corrections...

File: src/AspNetStaticContrib.Stekeblad/Extensions/IHostExtensions.cs

  • Line 41: if (!empoweredProvider.Resources.Any()) throw... Why? AspNetStatic exiting when there are no resources to process isn't a "limitation". Besides, that occurs after you've had a chance to populate the resource collection, so why would it prevent you from populating the resource collection beforehand?
  • Line 48: Why not just call empoweredProvider.LocateResourcesAsync() in the lambda instead of calling the private method (LocateStaticResourcesAsync) that calls it?

File: src/AspNetStaticContrib.Stekeblad/ResourceLocators/ActionDescriptor/ActionDescriptorQueryingMiddleware.cs

  • Line 45: Requiring the remote/caller IP to be the loopback address may cause issues in some edge cases. Is this check really necessary? Isn't it enough to check that it's an AspNetStatic request?

File: Readme.md

  • Line 27: "The built-in once..." s/b "The built-in ones..." -or- "The built-in resource locators...".
  • Line 30: It's not clear what this is trying to convey. I think it's try to say... to use the built-in resource locators, call AddAspNetStaticContribStekeblad and enable the locators by setting the config options...?
  • Line 140: Change to: "All ResourceLocatorBase implementations must perform the following tasks in LocateResourcesAsync:".

Happy New Year!

@Stekeblad
Copy link
Contributor Author

IHostExtensions.cs

  • Line 41: Your right! I'll fix. That was true in 0.26.2 when the check was made before registering on ApplicationStarted and I didn't notice that the check was moved into it.
  • Line 48: At one point there was more logic in that method. I agree it's not needed anymore and will inline it

ActionDescriptorQueryingMiddleware.cs

  • I just found a way to do this without using a custom endpoint or middleware. I will remove the middleware and related stuff and move the needed logic into ActionDescriptorPageResourceLocator. This also removes the need for checking for loopback or IsAspNetStaticRequest.

Readme.md

  • Line 27: Corrected.
  • Line 30: I have rewritten that point.
  • Line 140: Your suggestion sounds better.

Happy New Year to you to!

…t is not actually an issue. Inlined the private method in the same class that only had one line of code in it.
…rtupFilter after finding a way to get the same result all contained inside ActionDescriptorPageResourceLocator.
@ZarehD ZarehD merged commit e935b5a into ZarehD:master Dec 31, 2025
1 check passed
@ZarehD
Copy link
Owner

ZarehD commented Dec 31, 2025

Thank you for the contribution, @Stekeblad. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants