Title: SV: Problem with Filters and RequestDispatcher in Orion 1.4.5
Orion invokes filters on _every request_. That's internal and external. This is IMHO the way it should be done. (Some filters require this to work!) Tomcat only invokes it on _external requests_. AFAIK there is some debate about this at the moment in the 2.3 spec team but I hope it is resolved on the Orion side ;)
 
To standardise the behaviour, just put a request attribute ("__myfilter_applied" or whatever) in the request when your filter is first invoked. Every time it is invoked, check for this, and if present it means the current request is an include and you can ignore it.
 
-mike
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Anders Janmyr
Sent: Friday, March 23, 2001 11:02 PM
To: Orion-Interest
Subject: SV: Problem with Filters and RequestDispatcher in Orion 1.4.5

My filter and it's mapping is shown below. Tomcat does not invoke the filter when the RequestDispatcher is used.
Since the RequestDispatcher is internal it would seem that it should not invoke the filters. This is however not specified in the Servlet2.3 spec.
 
As you can see in this configuration the LoginPage is in the protected directory. If I move it out everything works properly unless I try to include a file from the protected directory. Then the filter is invoked again.
I don't think this is the way it should work.
 
 
Anders
 
    <filter>
        <filter-name>HtmlLoginFilter</filter-name>
        <filter-class>com.netpuls.servlet.LoginFilter</filter-class>
     <init-param>
         <param-name>loginPage</param-name>
         <param-value>/html/login.jsp</param-value>
     </init-param>
     <init-param>
         <param-name>failedLoginPage</param-name>
         <param-value>/html/failedLogin.jsp</param-value>
     </init-param>
     <init-param>
         <param-name>loginHandler</param-name>
         <param-value>com.netpuls.np.WebUser</param-value>
     </init-param>
    </filter>
    <filter-mapping>
        <filter-name>HtmlLoginFilter</filter-name>
        <url-pattern>/html/*</url-pattern>
    </filter-mapping>
-----Ursprungligt meddelande-----
Fr�n: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]F�r Magnus Rydin
Skickat: den 23 mars 2001 09:46
Till: Orion-Interest
�mne: SV: Problem with Filters and RequestDispatcher in Orion 1.4.5

How does your filter mapping look?
Does Tomcat ivoke filters on forward/include?
WR

> -----Ursprungligt meddelande-----
> Fr�n: Anders Janmyr [mailto:[EMAIL PROTECTED]]
> Skickat: den 23 mars 2001 00:25
> Till: Orion-Interest
> �mne: Problem with Filters and RequestDispatcher in Orion 1.4.5
>
>
> Hello,
>
> I am trying to use filters for authenticating users. My filter uses
> RequestDispatcher.forward to show a login page when the user needs to
> authenticate himself.
>
> This results in the filter beeing invoked again. It seems that the
> RequestDispatcher in orion (both forward and include) invokes
> the filter
> again. Tomcat does not do this. What is the correct behavior?
> The spec does
> not say how it should be working.
>
> Any help would be appreciated.
>
> Anders
>
>

Reply via email to