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:
http://example.com/foo/one => /var/lib/one/bar
http://example.com/foo/two => /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?
Thanks,
Johannes.