You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Terrence Szeto <t3...@hotmail.com> on 2002/02/11 21:25:32 UTC

Filters running twice!!!

I'm not sure why, but the filters which I have on my servers are running 
twice.

my ROOT/WEB-INF/web.xml file looks like this

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

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

  <security-constraint>
    <web-resource-collection>
     <web-resource-name>protected</web-resource-name>
     <url-pattern>/protected/*</url-pattern>
     <url-pattern>/main.jsp</url-pattern>
    </web-resource-collection>

     <auth-constraint>
      <role-name>role1</role-name>
      <role-name>tomcat</role-name>
    </auth-constraint>

  </security-constraint>

  <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/error.jsp</form-error-page>
    </form-login-config>
  </login-config>

  <filter>
    <filter-name>dbLogFilter</filter-name>
    <filter-class>com.cybermation.support.filters.DbLogFilter</filter-class>
  </filter>

  <filter>
    <filter-name>restrictFilter</filter-name>
    
<filter-class>com.cybermation.support.filters.RestrictFilter</filter-class>
  </filter>

  <filter>
    <filter-name>logFilter</filter-name>
    <filter-class>LogFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>logFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>dbLogFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>restrictFilter</filter-name>
    <url-pattern>/protected/files/*</url-pattern>
  </filter-mapping>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

</web-app>

Does anyone know why this happens?  or what's the work around for a 
solution?

Thanks.


Terrence Szeto
Cybermation
Web Architect



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Filters running twice!!!

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 11 Feb 2002, Terrence Szeto wrote:

> Date: Mon, 11 Feb 2002 15:25:32 -0500
> From: Terrence Szeto <t3...@hotmail.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Filters running twice!!!
>
> I'm not sure why, but the filters which I have on my servers are running
> twice.
>

It doesn't really help you solve this problem, but I'd be quite amazed
that this webapp runs at all, since you have the elements out of the order
that's required by the DTD.  Tomcat should have thrown an XML parsing
exception and refused to run your app.

One other thing to watch out for is if the app is getting initialized
twice somehow.

Craig


> my ROOT/WEB-INF/web.xml file looks like this
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
>
>   <security-constraint>
>     <web-resource-collection>
>      <web-resource-name>protected</web-resource-name>
>      <url-pattern>/protected/*</url-pattern>
>      <url-pattern>/main.jsp</url-pattern>
>     </web-resource-collection>
>
>      <auth-constraint>
>       <role-name>role1</role-name>
>       <role-name>tomcat</role-name>
>     </auth-constraint>
>
>   </security-constraint>
>
>   <login-config>
>     <auth-method>FORM</auth-method>
>     <form-login-config>
>       <form-login-page>/login.jsp</form-login-page>
>       <form-error-page>/error.jsp</form-error-page>
>     </form-login-config>
>   </login-config>
>
>   <filter>
>     <filter-name>dbLogFilter</filter-name>
>     <filter-class>com.cybermation.support.filters.DbLogFilter</filter-class>
>   </filter>
>
>   <filter>
>     <filter-name>restrictFilter</filter-name>
>
> <filter-class>com.cybermation.support.filters.RestrictFilter</filter-class>
>   </filter>
>
>   <filter>
>     <filter-name>logFilter</filter-name>
>     <filter-class>LogFilter</filter-class>
>   </filter>
>
>   <filter-mapping>
>     <filter-name>logFilter</filter-name>
>     <url-pattern>/*</url-pattern>
>   </filter-mapping>
>
>   <filter-mapping>
>     <filter-name>dbLogFilter</filter-name>
>     <url-pattern>/*</url-pattern>
>   </filter-mapping>
>
>   <filter-mapping>
>     <filter-name>restrictFilter</filter-name>
>     <url-pattern>/protected/files/*</url-pattern>
>   </filter-mapping>
>
>   <welcome-file-list>
>     <welcome-file>index.jsp</welcome-file>
>   </welcome-file-list>
>
> </web-app>
>
> Does anyone know why this happens?  or what's the work around for a
> solution?
>
> Thanks.
>
>
> Terrence Szeto
> Cybermation
> Web Architect
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>