You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resource handling is inconsistent across different embedded containers #8299
The behaviour of embedded Tomcat, Jetty, and Undertow is inconsistent when the containers themselves are dealing with static resources, i.e. when Spring MVC's resource handling isn't involved. For example, support for loading resources from META-INF/resources of nested jars works with Tomcat but doesn't work with Undertow. Furthermore, I believe it only works with Tomcat when Jasper's on the classpath.
We should consider configuring the containers such that they can serve resources from BOOT-INF/classes/META-INF/resources. This would allow a jar-packaged project to place static resources in src/main/resources/META-INF/resources rather than having to move them out into a separate project that's depended upon (see #8324). A war file doesn't have this problem as war projects can place resources directly in src/main/webapp from where they'll end up in the root of the war.
Just wondering, where should I put static resources when using embedded Undertow? I have created a jar file that contains these resources and this is working fine when unsing tomcat or jetty, but undertow does not find the resources.
Or is a fix for this issue imminent?
As long as you're using the latest version of 1.4.x and 1.5.x, it should work the same way in all three embedded containers. If you've found a situation where that's not the case, please open a new issue with a small sample that reproduces the problem.
I am using 1.5.2 and tomcat and jetty is working fine, but not undertow. All I do to switch, is change this dependency: compile("org.springframework.boot:spring-boot-starter-jetty") to either starter.tomcat or starter.undertow..
I am also using JSF, not sure if that makes a difference...
Seems like this is related to JSF, more specific Primefaces and their themes.
Under /META-INF/resources/ there is another directory called resources and beneath this, there is a directory called theme-name, and beneath this again is the folders needed for this theme (css, images, etc).
The error I get when running under Undertow, is:
JSF1064: Unable to find or serve resource, css/layout.css, from library, theme-name
Does this help or do you still need me to open a new issue with a sample case?
Activity
wilkinsona commentedon Feb 16, 2017
Expectations
Fat war
For war files, we're interested in resources in these three locations:
Accessing resources via HTTP and via the servlet context (SC) should have the following results:
/nested-meta-inf-resources.txt/nested-meta-inf-resources.txt/meta-inf-resources.txt/meta-inf-resources.txt/resource.txt/resource.txtFat jar
For jar files, we're interested in resources in these locations:
Accessing resources via HTTP and via the servlet context should have the following results:
/nested-meta-inf-resources.txt/nested-meta-inf-resources.txt/meta-inf-resources.txt/meta-inf-resources.txt/resource.txt/resource.txtActual behaviour
Fat war
/nested-meta-inf-resources.txt/nested-meta-inf-resources.txt/meta-inf-resources.txt/meta-inf-resources.txt/resource.txt/resource.txt(1) - Tomcat only works when Jasper in on the classpath
Fat jar
/nested-meta-inf-resources.txt/nested-meta-inf-resources.txt/meta-inf-resources.txt/meta-inf-resources.txt/resource.txt/resource.txt(1) - Tomcat only works when Jasper in on the classpath
wilkinsona commentedon Feb 18, 2017
We should consider configuring the containers such that they can serve resources from
BOOT-INF/classes/META-INF/resources. This would allow a jar-packaged project to place static resources insrc/main/resources/META-INF/resourcesrather than having to move them out into a separate project that's depended upon (see #8324). A war file doesn't have this problem as war projects can place resources directly insrc/main/webappfrom where they'll end up in the root of the war.Make static resource handling consistent across embedded containers
bjorntj commentedon Mar 28, 2017
Just wondering, where should I put static resources when using embedded Undertow? I have created a jar file that contains these resources and this is working fine when unsing tomcat or jetty, but undertow does not find the resources.
Or is a fix for this issue imminent?
wilkinsona commentedon Mar 28, 2017
As long as you're using the latest version of 1.4.x and 1.5.x, it should work the same way in all three embedded containers. If you've found a situation where that's not the case, please open a new issue with a small sample that reproduces the problem.
bjorntj commentedon Mar 28, 2017
I am using 1.5.2 and tomcat and jetty is working fine, but not undertow. All I do to switch, is change this dependency: compile("org.springframework.boot:spring-boot-starter-jetty") to either starter.tomcat or starter.undertow..
I am also using JSF, not sure if that makes a difference...
bjorntj commentedon Mar 28, 2017
Seems like this is related to JSF, more specific Primefaces and their themes.
Under /META-INF/resources/ there is another directory called resources and beneath this, there is a directory called theme-name, and beneath this again is the folders needed for this theme (css, images, etc).
The error I get when running under Undertow, is:
JSF1064: Unable to find or serve resource, css/layout.css, from library, theme-name
Does this help or do you still need me to open a new issue with a sample case?
wilkinsona commentedon Mar 28, 2017
If you'd like us to investigate, we'll need a new issue with a sample case please.
pleku commentedon Dec 3, 2018
wilkinsona commentedon Dec 3, 2018
pleku commentedon Dec 3, 2018
Will do, sorry and thanks!