You could possibly use io.undertow.server.handlers.resource.ResourceSupplier, and then use PathResourceManager under the hood to actually return a path resource. If all these files have a common root path you could basically create a PathResourceManager that maps to this, and then use Map<String, Resource> in the supplier.


On Tue, Feb 6, 2018 at 9:06 PM, Johannes Ernst <> wrote:
I’m attempting to serve a bunch of static files, which exist in the file system, but in various directories that do not correspond to the URL namespace. Example:  =>  /var/lib/one/bar  =>  /var/lib/two/bar

I have the mapping from incoming request URL to File to be served in a Map<String,File>. Now I’m attempting to hook up Undertow so it can serve those files according to my mapping, and I’m not entirely sure where to best plug this in without having to write loads of code.

As far as I can tell, I would need to implement my version of ResourceManager and Resource, sort of like File/PathResource/Manager, but there’s a lot of code there, not all of which I understand, and it would perhaps turn into a maintenance nightmare on my end.

I cannot see a straightforward way of overriding those classes either to “slide in” an alternate mapping.

Is there a better way of doing this?



undertow-dev mailing list