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@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@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@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@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev

_______________________________________________
undertow-dev mailing list
undertow-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev