[undertow-dev] Resource Handling Revisited

Hicks, Matt matt at matthicks.com
Fri Jan 6 16:06:38 EST 2017


It took me a while to get the time to do this, but I just submitted a PR
that extracts the functionality into an AbstractResourceHandler to allow
other methodologies without compromising the existing paradigm.

https://github.com/undertow-io/undertow/pull/470

I wasn't able to extract it into a static method as there are too many
configuration options that it needs access to for it to be practical.

On Tue, Jan 3, 2017 at 2:48 PM Stuart Douglas <sdouglas at redhat.com> wrote:

> If you submit a PR I would be happy to look at it.
>
> Stuart
>
> On Wed, Jan 4, 2017 at 2:09 AM, Hicks, Matt <matt at matthicks.com> wrote:
> > Bill, though you're probably right, I still believe this would be useful
> > functionality for one-off resource handling without requiring a resource
> > handler.
> >
> > On Mon, Jan 2, 2017 at 8:59 PM Bill O'Neil <bill at dartalley.com> wrote:
> >>
> >> You should be able to handle all of your use cases by composing handlers
> >> together. Create a new handler that handles security or the database
> logic
> >> then delegates to an internal resource handler with the appropriate
> path.
> >>
> >> On Mon, Jan 2, 2017 at 9:50 PM, Hicks, Matt <matt at matthicks.com> wrote:
> >>>
> >>> The problem with ResourceHandler is it doesn't easily support more
> >>> complex scenarios.  A few examples: security on resources, URLs that
> must
> >>> find a resource path from the database, conditional resources (deliver
> >>> resource A if the IP is x.x.x.x and resource B otherwise), etc.
> >>>
> >>> Offering a more granular control to allow delivery of individual
> >>> resources without the need of a ResourceHandler will drastically
> improve the
> >>> flexibility of Undertow.
> >>>
> >>> On Mon, Jan 2, 2017 at 4:46 PM Stuart Douglas <sdouglas at redhat.com>
> >>> wrote:
> >>>>
> >>>> I would be ok with that, however why can't you just use the
> >>>> ResourceHandler? PathResourceManager will use transferFrom if the file
> >>>> is larger than a configured minimum (the transferMinSize parameter in
> >>>> the constructor).
> >>>>
> >>>> Stuart
> >>>>
> >>>> On Wed, Dec 28, 2016 at 1:52 AM, Hicks, Matt <matt at matthicks.com>
> wrote:
> >>>> > Previously I've asked about streaming a single file back to the
> client
> >>>> > and
> >>>> > got some good insight as to how to accomplish this with
> >>>> > `transferFrom`, but
> >>>> > this misses out on all the extra features like resuming transfers,
> >>>> > cached
> >>>> > content, etc.  It would be very nice Undertow offered a static
> utility
> >>>> > method to serve up File, Path, and URL providing all of this
> >>>> > functionality
> >>>> > that is currently contained in ResourceHandler
> >>>> >
> >>>> > (
> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/resource/ResourceHandler.java#L155
> ).
> >>>> >
> >>>> > I don't think it would be difficult to extract all of that out of
> the
> >>>> > private method and simply have ResourceHandler call the static
> method.
> >>>> > Stuart, what do you think?
> >>>> >
> >>>> > I'd even be willing to do the leg-work if you'd be willing to
> accept a
> >>>> > PR
> >>>> > for it.
> >>>> >
> >>>> > _______________________________________________
> >>>> > undertow-dev mailing list
> >>>> > undertow-dev at lists.jboss.org
> >>>> > https://lists.jboss.org/mailman/listinfo/undertow-dev
> >>>
> >>>
> >>> _______________________________________________
> >>> undertow-dev mailing list
> >>> undertow-dev at lists.jboss.org
> >>> https://lists.jboss.org/mailman/listinfo/undertow-dev
> >>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170106/98ab077b/attachment.html 


More information about the undertow-dev mailing list