Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Add URL templates match by extension #745

Closed

Description

@BbIKTOP

Since regex is not working, is it possible at least to add url match by extension? Like this:

diff WebHandlerImpl.h WebHandlerImpl.h.orig
108,115d107
<       if (_uri.length() && _uri.startsWith("/*.")) {
<         String uriTemplate = String (_uri);
<         uriTemplate = uriTemplate.substring(uriTemplate.lastIndexOf("."));
<         if (!request->url().endsWith(uriTemplate))
<           return false;
<       }
<       else

Activity

  1. stale commented on Jun 10, 2020

    @stale

    [STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  2. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    Anyone alive here?

  3. stale commented on Jun 11, 2020

    @stale

    [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

  4. BlueAndi commented on Jun 11, 2020

    @BlueAndi

    You could create your own handler and register it.

  5. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    @BlueAndi Sorry, don’t understand, could you explain please? How to create handler for some particular file type/extension? I tried regular expressions first, even considered they’re very heavy and consume a lot of precious resources on esp8266, but didn’t succeed since there’s a bug in the current gcc. How can i make different handlers now?
    Thank you

  6. BlueAndi commented on Jun 11, 2020

    @BlueAndi

    You can add a handler via

    AsyncWebHandler& addHandler(AsyncWebHandler* handler);

    Inherit your handler from AsyncWebHandler, like its done for the AsyncStaticWebHandler.
    This way you could create it, as you shown in your initial post.

    A different way would be to register a callback for "/xxx/yyy/*" via

    AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest);

    In the callback you get access to the requested uri by request->url() and you can post-process it there.

    The better option depends on how many different uri you will have.

  7. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    @BlueAndi but i need different handlers for different file types (i.e. file extensions)
    Current url parameter does not support this, isn’t it?

  8. BlueAndi commented on Jun 11, 2020

    @BlueAndi

    Yes and no. If your handler (option 1 above) is generic enough on the interface, you implement it once, but instantiate it several times with different file extensions as parameter.

    Yes, current url parameter doesn't support this.

  9. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    @BlueAndi so, why not simplify this and just add a few lines of code from my pr #751? It will provide a simple intuitive way to implement such a functionality

  10. BlueAndi commented on Jun 11, 2020

    @BlueAndi

    Not my decision, you have to wait for the maintainer. ;-)

  11. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    @BlueAndi Sure, but looks like nobody here for months...

  12. me-no-dev commented on Jun 11, 2020

    @me-no-dev
    Owner

    he will show up when he has time :) preoccupied with a lot of work.

  13. BbIKTOP commented on Jun 11, 2020

    @BbIKTOP
    ContributorAuthor

    @me-no-dev same here, mate, same here... waiting patiently, thank you!

  14. BlueAndi commented on Jun 11, 2020

    @BlueAndi
  15. stale commented on Aug 11, 2020

    @stale

    [STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  16. BbIKTOP commented on Aug 11, 2020

    @BbIKTOP
    ContributorAuthor

    Please, no “stale”, just add it ;)

  17. stale commented on Aug 11, 2020

    @stale

    [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

  18. stale commented on Oct 10, 2020

    @stale

    [STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  19. BbIKTOP commented on Oct 11, 2020

    @BbIKTOP
    ContributorAuthor

    Please, merge it

  20. stale commented on Oct 11, 2020

    @stale

    [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions