tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben short" <...@benshort.co.uk>
Subject Servlet Mappings
Date Mon, 30 Oct 2006 10:35:01 GMT
Hi I am having some trouble with setting up my servlet mappings. I am
replacing a legacy webapp but need to keep the same urls. The current
webapp uses cocoon.

Here is my web.xml

<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">

  <display-name>Webapp</display-name>

        <!--
	  - Location of the Log4J config file, for initialization and refresh checks.
	  - Applied by Log4jConfigListener.
	  -->
	<context-param>
		<param-name>log4jConfigLocation</param-name>
		<param-value>/WEB-INF/log4j.properties</param-value>
	</context-param>

    <listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>


    <context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
            /WEB-INF/formats.xml
			/WEB-INF/controllers.xml
			/WEB-INF/conf/global_conf.xml
			/WEB-INF/conf/customer1_conf.xml
        </param-value>
	</context-param>

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

    <servlet>
        <servlet-name>test</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>testerror</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>testerror</servlet-name>
        <url-pattern>/error/*</url-pattern>
    </servlet-mapping>

     <servlet-mapping>
        <servlet-name>test</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
      <servlet-name>default</servlet-name>
      <url-pattern>/images</url-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>

</web-app>

With this setup requests that start with /error go to the testerror
servlet, all other requests go to the test servlet.

Can anyone give me some pointers?

Ben

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message