Reputation: 75137
I am using Spring Security 3. I have files unders /js, /css and /img folders and imports them HTML files. I want to serve them with mvc:resource because I can add expire-head easily and I think it gives a url-rewriting ability. However I am so new to Spring Security and don't know the purpose of it and how can I use it?
An example usage at my HTML webpages:
<link rel="stylesheet" href="/css/main.css"/>
Upvotes: 0
Views: 1880
Reputation: 9255
The mvc:resources
tag has nothing to do with Spring Security - it tells Spring MVC to not pass those resources through the RequestDispatcher
servlet, but to serve them up directly. Instead, you want to exclude those same directories from Spring Security resource controls, as follows:
<intercept-url pattern="/css/**" filters="none"/>
<intercept-url pattern="/js/**" filters="none"/>
<intercept-url pattern="/img/**" filters="none"/>
See http://static.springsource.org/spring-security/site/docs/3.0.x/reference/ns-config.html#ns-minimal for full details.
Upvotes: 1