A, static resources access, CSS, JS, static page
We know that SPRINGMVC's core configuration is Dispatcherservlet, and all our requests go through the servlet
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/spring-mvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-patten> / </url-patten>// This is/, spring will intercept all requests, and if it is. Do,.action you don't have to look at the static resources below .
</servlet-mapping>
Because I am configured here/, will intercept all, so will block CSS, JS, static page of course you can also configure. Action or. Do but do not match/*
1, activate the container such as Tomcat, Jetty Defaultservlet to deal with static pages, where the <servlet-mapping> to the SPRINGMVC servlet above
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-patten>*.css</url-patten>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-patten>*.js</url-patten>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-patten>*.png</url-patten>
</servlet-mapping>
If the picture has another format, add the change configuration
the easy way to configure is
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-patten>*.css</url-patten>
<url-patten>*.js</url-patten>
<url-patten>*.png</url-patten>
<url-patten>images/*</url-patten>
<url-patten>static/*</url-patten>
</servlet-mapping>
The servlet-name of different service containers are not the same
Tomcat, Jetty, JBoss, GlassFish defaults servlet name: Default
Google App Engine default servlet name: _ah_default
Resin default servlet name: Resin-file
WebLogic default name: Fileservlet
WebSphere default servlet name: Simplefileservlet
2, spring3.0.4 after the use of <mvc:resources mapping= "" location= ""/>
Increase in Spring-mvc.xml configuration
<mvc:resources mapping= "/images/**" location= "/images/"/>
<mvc:resources mapping= "/js/**" location= "/js/"/>
Location indicates the path where the resource file is located, by default under WebApp, or location= "/web-inf/images/" If you want to put it under Web-inf
3, <mvc:default-servlet-handler/>
This way access performance is poor, this is equivalent to "/**" registered to simpleurlhandlermapping UrlMap, Transfer access to static resources from handlermapping to Org.springframework.servlet.resource.DefaultServletHttpRequestHandlet processing and return
Defaultservlethttprequesthandler is the default servlet
multiple handlermapping execution order for each servlet container itself:
Defaultannotationhandlermapping Order Property Value: 0
The order attribute value of the simpleurlhandlermapping <mvc:resources/> Autoenrollment is: 2147483646
<mvc:default-servlet-handler/ > Automatic registration of the Simpleurlhandlermapping order attribute value is: 2147483647 the
next article mainly said that SPRINGMVC interceptor to the authorization, After that, through the Apache Shrio authorization framework, the next certification and licensing