I have a web app: MyApp.war, inside it, I have a jar file: WEB-INF/lib/PublicJar.jar
-
I want client applications to be able to download that jar like a web resource.
e.ghttp://theserver.com/myapp/jars/PublicJar.jar -
I want the web application to be able to compute the hashcode of the jar file to
see if it has changed, so clients know if it needs to reload it.
Can this be done?
Resources inside
WEB-INFcannot be served directly to the client. If you want to do that, you need to write a servlet/controller to extract it as aServletContextresource and feed it to the http response.Is
PublicJar.jaralso used by your application itself? Could you not move it out ofWEB-INF, or maybe bundle two copies of it in the WAR, one underWEB-INF(for internal application use), and one for downloading?