The pit in the TOMCAT7. About Welcome-list and servlet-mapping

Source: Internet
Author: User

In Web. XML, filters are set for static resource suffix names using the default servlet. And Welcome-list is set up, using jetty and tomcat6 to start everything is OK, but using TOMCAT7 will not be possible to access the root node (/).

Then the red part is removed before it is normal.

Principles and more elegant solutions:

Security issues before Tomcat 6.0.30: https://issues.apache.org/bugzilla/show_bug.cgi?id=50026

Using Spring's resource tag: http://docs.spring.io/spring/docs/3.0.5.RELEASE/spring-framework-reference/html/mvc.html# Mvc-static-resources

It is not recommended to use the container's own default servlet for mapping:http://webmasters.stackexchange.com/questions/29550/ Why-the-difference-between-tomcat-and-tomcat7-regarding-servlet-mapping-and-defa

Questions about static resource mapping: http://stackoverflow.com/questions/870150/ how-to-access-static-resources-when-using-default-servlet/3593513#3593513

<!--increase access speed by configuring several of the most common static resources before Springservlet -    <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.html</u Rl-pattern> </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.css</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.js</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.gif</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.jpg</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.png</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.eot</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.svg</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.ttf</Url-pattern>    </servlet-mapping>    <servlet-mapping>        <Servlet-name>Default</Servlet-name>        <Url-pattern>*.woff</Url-pattern>    </servlet-mapping>    <!--Spring MVC Configuration -    <servlet>        <Servlet-name>Springservlet</Servlet-name>        <Servlet-class>Org.springframework.web.servlet.DispatcherServlet</Servlet-class>        <Init-param>            <Param-name>Contextconfiglocation</Param-name>            <Param-value>Classpath:/spring/applicationcontext-mvc.xml</Param-value>        </Init-param>        <Load-on-startup>1</Load-on-startup>    </servlet>    <servlet-mapping>        <Servlet-name>Springservlet</Servlet-name>        <Url-pattern>/</Url-pattern>    </servlet-mapping>    <welcome-file-list>        <Welcome-file>/index.html</Welcome-file>    </welcome-file-list>

The pit in the TOMCAT7. About Welcome-list and servlet-mapping

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.