0 Replies Latest reply on Jul 1, 2012 11:54 PM by Sam W

    Can't establish servlet-mapping.

    Sam W Expert

      Hi with spring mvc 3.1.1, I am trying to use the following web.xml configuration to establish a servlet mapping (for /image/*):

       

       

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <web-app xmlns="http://java.sun.com/xml/ns/j2ee"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

                version="2.4">

       

       

                <!-- The master configuration file for this Spring web application -->

          <context-param>

              <param-name>contextConfigLocation</param-name>

              <param-value>

                                    /WEB-INF/config/web-application-config.xml

              </param-value>

          </context-param>

       

       

                <!-- Loads the Spring web application context -->

          <listener>

              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

          </listener>

       

       

                <!-- Enables use of HTTP methods PUT and DELETE -->

          <filter>

              <filter-name>httpMethodFilter</filter-name>

              <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>

          </filter>

       

       

          <filter-mapping>

              <filter-name>httpMethodFilter</filter-name>

              <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

          </filter-mapping>

       

       

                <!-- Enables Spring Security -->

          <filter>

              <filter-name>springSecurityFilterChain</filter-name>

              <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

          </filter>

       

       

          <filter-mapping>

              <filter-name>springSecurityFilterChain</filter-name>

              <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

          </filter-mapping>

       

       

          <!-- category image servlet -->

       

       

         <servlet>

              <servlet-name>categoryImageServlet</servlet-name>

              <servlet-class>ix.houseware.category.servlet.CategoryImageServlet</servlet-class>

          </servlet>

          <servlet-mapping>

              <servlet-name>categoryImageServlet</servlet-name>

              <url-pattern>/image/*</url-pattern>

          </servlet-mapping>

       

       

                <!-- The front controller of this Spring Web application, responsible for handling all application requests -->

          <servlet>

              <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

              <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

              <init-param>

                  <param-name>contextConfigLocation</param-name>

                  <param-value></param-value>

              </init-param>

              <load-on-startup>1</load-on-startup>

          </servlet>

       

                <!-- Map all *.spring requests to the DispatcherServlet for handling -->

          <servlet-mapping>

              <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

              <url-pattern>/</url-pattern>

          </servlet-mapping>

             

         

      </web-app>

       

       

      but on start up or loading the war file, I can't see this mapping is established.

      Is there anything I have overlook?

      Very appreciate for any suggestion.

      Thanks

      Sam