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