Tomcat - 未调用Servlet过滤器

时间:2013-05-11 14:02:59

标签: java tomcat servlet-filters web.xml

我在我的应用程序中使用了一个名为“Controller”的servlet过滤器,它对其他servlet进行了一些预处理。

这在我的Dev环境中完美运行,但是当我将它上传到我的托管环境时, 根本不会调用过滤器。有什么可能是错的想法吗?

web.xml下方附加。我在JBoss 4.2中运行Dev,而托管运行Tomcat 7。 感谢您的帮助。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>Directory</display-name>
  <welcome-file-list>
    <welcome-file>index</welcome-file>
  </welcome-file-list>
  <filter>
    <display-name>Controller</display-name>
    <filter-name>Controller</filter-name>
    <filter-class>com.dir.filter.Controller</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>Controller</filter-name>
    <url-pattern>/labels/*</url-pattern>
    <url-pattern>/people/*</url-pattern>
    <url-pattern>/account/*</url-pattern>
  </filter-mapping>
  <servlet>
    <description></description>
    <display-name>Initializer</display-name>
    <servlet-name>Initializer</servlet-name>
    <servlet-class>com.dir.servlet.Initializer</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Initializer</servlet-name>
    <url-pattern>/Initializer</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>Account</display-name>
    <servlet-name>Account</servlet-name>
    <servlet-class>com.dir.servlet.Account</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Account</servlet-name>
    <url-pattern>/account/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>People</display-name>
    <servlet-name>People</servlet-name>
    <servlet-class>com.dir.servlet.People</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>People</servlet-name>
    <url-pattern>/people/*</url-pattern>
  </servlet-mapping>
  <error-page>
    <error-code>404</error-code>
    <location>/weberror.jsp</location>
  </error-page>

  <servlet>
    <description></description>
    <display-name>OutputRenderer</display-name>
    <servlet-name>OutputRenderer</servlet-name>
    <servlet-class>com.dir.servlet.OutputRenderer</servlet-class>
  </servlet>
  <servlet>
    <description></description>
    <display-name>Labels</display-name>
    <servlet-name>Labels</servlet-name>
    <servlet-class>com.dir.servlet.Labels</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Labels</servlet-name>
    <url-pattern>/labels/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>Index</display-name>
    <servlet-name>Index</servlet-name>
    <servlet-class>com.dir.servlet.Index</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Index</servlet-name>
    <url-pattern>/index</url-pattern>
  </servlet-mapping>
</web-app>

0 个答案:

没有答案