How does it redirect to the filter? That doesn't make sense - after
your servlet throws an exception it can't do a redirect.

Filters are always called *before* the servlet or JSP. The servlet is
only called if all the filters before it call doFilter to pass the
request on. When your servlet runs, either your filter was already
invoked (and is still on the call stack) or the filter is not invoked
at all. I don't see any other possibilities.

When your servlet throws the exception, do you get a stack trace in
Tomcat's log file? Does it show both the servlet and the filter?
-- 
Len

On Jan 3, 2008 2:27 PM, Jay Liu <[EMAIL PROTECTED]> wrote:
> Hi,
>
>     <servlet-mapping>
>         <servlet-name>Checkout</servlet-name>
>         <url-pattern>/Checkout</url-pattern>
>     </servlet-mapping>
>
> That's the only mapping I have for it. I will try the url pattern.
>
>
> The checkout servlet gets invoked, (I see a null pointer thrown from it)
> then it gets redirected to the filter.
>
> I saw an example somewhere that had the mappings altered. That's all.
>
> Thanks again,
> Jay
> -----Original Message-----
> From: Milanez, Marcus [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 03, 2008 6:30 AM
> To: Tomcat Users List; [EMAIL PROTECTED]
> Subject: RES: Servlet Filter Not Intercepting?
>
>
> Hi Jay,
>
> Your configuration seems to be fine.. Is your Checkout servlet ever invoked,
> cause you haven't posted your servlet-mapping tags. Have you tried mapping
> your filter using url-patterns, instead of servlet-name ? And only one more
> question, what do you mean by 'turn off invonking the resource' ?
>
> Yours,
>
> Marcus Milanez
>
>
> -----Mensagem original-----
> De: Jay Liu [mailto:[EMAIL PROTECTED]
> Enviada em: quinta-feira, 3 de janeiro de 2008 01:49
> Para: 'Tomcat Users List'
> Assunto: RE: Servlet Filter Not Intercepting?
>
> Thanks Marcus.
>
> Here's my filter setup. I just created it fresh in netbeans so I'd be
> surprised if there is a problem.
>
> I woke up this morning, realizing I forgot to turn off invoking the
> resource. Would that matter?
>
>     <filter>
>         <filter-name>UserFilter</filter-name>
>         <filter-class>store.filters.UserFilter</filter-class>
>     </filter>
>     <filter-mapping>
>         <filter-name>UserFilter</filter-name>
>         <servlet-name>Checkout</servlet-name>
>     </filter-mapping>
>     <servlet>
>         <servlet-name>Checkout</servlet-name>
>
> <servlet-class>com.inifim.commerce.store.servlets.transactions.Checkout</ser
> vlet-class>
>     </servlet>
>
> I only have one filter right now.
>
> Thanks again,
> Jay
>
> -----Original Message-----
> From: Milanez, Marcus [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 02, 2008 5:21 AM
> To: Tomcat Users List; [EMAIL PROTECTED]
> Subject: RES: Servlet Filter Not Intercepting?
>
> Hi,
>
> Yes, filters atre supposed to intercept a requets just before it is
> accessed. Could you please post your filter config written in your web.xml
> file?
>
> Yours,
>
> Marcus Milanez
> http://sumatrablog.wordpress.com
>
> -----Mensagem original-----
> De: Jay Liu [mailto:[EMAIL PROTECTED]
> Enviada em: terça-feira, 1 de janeiro de 2008 18:36
> Para: users@tomcat.apache.org
> Assunto: Servlet Filter Not Intercepting?
>
> Hi all,
>
>
>
> I'm having a problem with filters. I setup filter to block access to a
> resource unless the user is authenticated.
>
>
>
> I've noticed that the resource is accessed then the filter kicks in and then
> loads.
>
>
>
> I thought filters were supposed to intercept the request before the resource
> is accessed?
>
>
>
> Is there something wrong with my xml configuration?
>
>
>
> Thanks,
>
> Jay
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to