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 <> 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 <> 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).


On Wed, Dec 28, 2016 at 1:52 AM, Hicks, Matt <> 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
> (
> 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 mailing list