Static resource serving
Closed this issue · 4 comments
It should be possible to load static resources. Currently, undertow can load from the file system in a direct URI. Figure out what would be needed to add resource loading as well from the classpath.
You can use ClassPathResourceManager
in this case. See for example https://github.com/shamoh/standalone-javax-mvc/blob/master/src/main/java/cz/kramolis/tests/mvc/Main.java source.
I can prepare a PR for this. Do you have some requirements?
It seems that the Hammock currently serves files from file-system. Right?
What about changing it to serving static file from class-path by default. Class-path "package" as well as web context path will be configurable, with smart defaults. For me the web context path smart default is root (/
).
And optionally it is possible to specify external file-system directory to override class-path approach.
What do you think?
@shamoh that would definitely work. however that only solves it for undertow. still need to address how to handle in tomcat, jetty.
I ended up going the servlet filter route - works in all components without extra config.