i have gwt-spring project , have 2 modules used libraries in web project, works fine, i'm trying put static resources on 1 of modules (jar) i'm not seeing resources when application deployed, i'm getting 404 when try them.
i'm using servlet 3.0 in web.xml , put line in application-config:
<mvc:resources mapping="/resources/**" location="classpath:/meta-inf/resources" ></mvc:resources>
also put resources under folder meta-inf/resources inside jar.
running project jetty (intellij) if go to: http://localhost:8888/path/resources can see whole list of folders (all folders put on meta-inf/resources jar , resources on web project, but jar can see folders, not files on them!.)
and if run project tomcat can see resources on web project jar.
any ideas?
the serving of /meta-inf/resources/
jars found in /web-inf/lib/*.jar
feature of servlet 3.0 spec.
as such, internal implementation of jetty (namely defaultservlet
) responsible serving content on requests content.
on jetty accomplished unpacking /meta-inf/resources/
contents webapp working directory served normal files disk.
however, using spring mvc, , configuration appears attempting circumvent facility of container. don't let spring mvc handle or serve resources, let flow out of spring , let web container serve resources.
besides, jetty's implementation can serve these (and kind of) static resource way way better generic servlet can (it uses internal features of jetty accomplish this).
example:
lets had foo.war
, /web-inf/lib/bar.jar
contained single resource /meta-inf/resources/js/main.js
.
assuming had jetty server connector on localhost:8080
, default webapp deployment, resulting in context path of /foo
foo.war
, resource accessed request http://localhost:8080/foo/js/main.js
created example project demonstrating at:
Comments
Post a Comment