-
Notifications
You must be signed in to change notification settings - Fork 38.5k
webjar stops working [SPR-12432] #17038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Brian Clozel commented Hi Titi Wangsa Could you copy/paste here the following:
You'll probably need to alter a bit your configuration or explicitly configure allowed locations in PathResourceResolver. Thanks, |
Titi Wangsa commented the problem is, these are webjar resources,
and in my spring-servlet.xml
i do not know why it is getting "bootstrapvalidator" for locationpath |
Brian Clozel commented
Are you sure you gave me all I've created a repro project to narrow down the current issue, and I couldn't reproduce it. You can check this working example here, and see that it's using as resourcehandler configuration: registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); Actually, with your current configuration I don't know how this worked with the previous versions. |
Titi Wangsa commented i followed the configuration here i have a working copy on github that works on 4.1.1 but fails on 4.1.2 |
Titi Wangsa commented created a minimal project to demonstrate this |
Titi Wangsa commented i dug deeper, resource = class path resource [META-INF/resources/webjars/bootstrap/3.3.1/css/bootstrap.min.css] resourcepath = META-INF/resources/webjars/bootstrap/3.3.1/css/bootstrap.min.css locationpath = META-INF/resources/webjars/ resourcePath.startsWith(locationPath) = true in my config: different resource class, yours was "class path resource", because you had the "classpath:" prefix, in ```
|
Titi Wangsa commented maybe we change from ```
|
Brian Clozel commented Hi Titi Wangsa Thanks for this report; this is indeed a regression that we will fix in the next 3.2.x, 4.0.x and 4.1.x versions. In the meantime, using a classpath-based location is a known workaround: // in configuration class, overriding addResourceHandlers
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); <!-- in a servlet xml configuration file -->
<mvc:resources location="classpath:/META-INF/resources/webjars/" mapping="/webjars/**" /> |
Titi Wangsa commented Thanks mate. |
Brian Clozel commented I'll resolve it when the fix will be merged in master - and we'll close this issue when the actual version fixing this is released. |
Titi Wangsa opened SPR-12432 and commented
The application manages to get the resources for webjar when using spring 4.1.0.
4.1.1 also works.
when i use 4.1.2, I get 404 errors
that is the only thing I changed.
example url:
http://localhost:8080/app1/webjars/jquery/2.1.1/jquery.min.js
works with spring 4.1.0
works with spring 4.1.1
does not work with 4.1.2 - giving 404 error
when i traced it, it lead to
org.springframework.web.servlet.resource.PathResourceResolver
the method "isResourceUnderLocation"
constantly returns false
this method is called by "checkResource", and this is new since 4.1.2.
Affects: 3.2.12, 4.0.8, 4.1.2
Backported to: 4.0.9, 3.2.13
The text was updated successfully, but these errors were encountered: