That is some good information which I wish I knew before I started the site!
What do you think the learning curve is on using filters and would it be
worth the effort (dicounting the time/cost factor) to reorganize my design
using proper filters?  What would be the major benefits of making this
change?

One last newby (and possibly very stupid) question...when you write
<filter-class>com.mycompany.MyAuthenticationFilter</filter-class> the
com.mycompany is simply indicating the package that MyAuthenticationFilter
is in, right, or am I completely missing what that indicates.  Sorry for the
very basic questions but I sincerely appreciate your help!!

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 10:36 AM
To: Tomcat Users List
Subject: RE: <welcome-file-list>


Hi,

>ok...bear with my skill level here...you're suggesting the
Authentication
>filter and monitor filter would be separate servlets?  Then when the
user

No.  I'm suggesting they be proper filters, per the servlet spec v2.3.
Specifically, you'd have two things that implement javax.servlet.filter:

public class MyAuthenticationFilter
  implements Filter {
...
}

public class MyMonitorFilter
  implements Filter {
...
}

And then in your web.xml:

<web-app>
...
  <filter>
    <filter-name>MyAuthenticator</filter-name>
    <filter-class>com.mycompany.MyAuthenticationFilter</filter-class>
  </filter>

  <filter>
    <filter-name>MyMonitor</filter-name>
    <filter-class>com.mycompany.MyMonitorFilter</filter-class>
  </filter>
  
  <filter-mapping>
    <filter-name>MyAuthenticator</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
 
  <filter-mapping>
    <filter-name>MyMonitor</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  ...

  <servlet>
    <servlet-name>MyMappedServlet</servlet-name>
    <servlet-class>com.mycompany.MyServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>MyMappedServlet</servlet-name>
    <url-pattern>/MyMappedServlet</url-pattern>
  </servlet-mapping>
 
  ...
</web-app>



>typed the www.whatever.org/, which one would be invoked?  What would
occur
>if the user typed www.whatever.org/MyServlet directly before the
>authenticator has authenticated the user?  Does the authenticator and
the
>monitor both recieve a request when a user types www.whatever.org?

Requests for your servlet would be intercepted by both filters before
(and after) the servlet gets them.  If you need help on the filter
design / implementation, post that question and we'll be glad to help ;)

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to