Well, I changed my pattern to /* and something strange happens in the doFilter 
method...

I am coming from /login.jsp and the navigation rule looks like this..:

<navigation-rule>
  <from-view-id>/login.jsp</from-view-id>
  <navigation-case>
   <from-outcome>success</from-outcome>
   <to-view-id>/protected/index.jsp</to-view-id>
  </navigation-case>
 </navigation-rule>

And when the outcome is success from /login.jsp, the correct page is showing
(/protected/index.jsp) but putting this call in the doFilter method:

writeLog(((HttpServletRequest)request).getRequestURL());

gives me the url to the previous page, /logins.jsf.. Shouldn't this be
/protected/index.jsf ?? But this explains why the patterng /protected/* didn't 
work, but
why is this the request url in doFilter??


BTJ



Matt Blum wrote:
> The only possibilities I can think of that would cause the behavior you
> describe are:
> 
> 1. The URL is being redirected before the filter is hit, so the
> url-mapping doesn't apply (you can test this by setting the pattern back
> to /* and outputting the path the filter finds).
> 
> 2. Another filter whose pattern is matched by the request (and which
> comes before the filter you're working on in your web.xml list of
> filter-mappings) is failing to call doFilter(request, response) on the
> FilterChain object it receives, for some reason.
> 
> -Matt
> 
> On 5/4/05, *Bj�rn T Johansen* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
> 
>     Yes, I do... But I have tried /faces/protected/* too, with no luck....
> 
>     BTJ
> 
>     Jonathan Eric Miller wrote:
>     > This is just a guess, but, if you have JSF configured to use
>     mappings like,
>     >
>     > /faces/*
>     >
>     > then, I think it might change the path to something like
>     > /faces/protected/<page>.jsp (so, I think you could setup a mapping of
>     > /faces/protected/* instead of /protected/*).
>     >
>     > I used to have mine setup like that, but, now I'm using a,
>     >
>     > *.faces
>     >
>     > mapping for faces. This way it doesn't mess around with the path.
>     >
>     > Jon
>     >
>     > ----- Original Message ----- From: "Bj�rn T Johansen" <
>     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>     > To: "MyFaces Discussion" <[email protected]
>     <mailto:[email protected]>>
>     > Sent: Wednesday, May 04, 2005 8:08 AM
>     > Subject: Re: Servlet Filter?
>     >
>     >
>     >> Yes, I am.... Maybe I'll check the request path...
>     >>
>     >> BTW, is SecurityFilter something else or just another name for
>     filter?
>     >>
>     >>
>     >> BTJ
>     >>
>     >> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
>     >>
>     >>> Hi
>     >>>
>     >>> I seem to remember that (look in an earlier thread) there is a
>     problem
>     >>> with that. Are you calling a faces page within that pattern?
>     >>>
>     >>> One soulution is to use the top-levek aproach and then check the
>     >>> requestpath in your filter (I use SecurityFilter for this).
>     >>>
>     >>> Hermod
>     >>>
>     >>> -----Original Message-----
>     >>> From: Bj�rn T Johansen [mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>]
>     >>> Sent: Wednesday, May 04, 2005 1:59 PM
>     >>> To: MyFaces Discussion
>     >>> Subject: Re: Servlet Filter?
>     >>>
>     >>>
>     >>> Yes, I discovered that there seems to be something wrong with my
>     >>> pattern...
>     >>> If I use /* as the pattern, it works...
>     >>> But if I use /protected/* then the filter is not called.. (I.e.
>     I want
>     >>> to protect
>     >>> every file and subfolders inside a folder called protected, how
>     should
>     >>> my pattern
>     >>> look like?
>     >>>
>     >>>
>     >>> BTJ
>     >>>
>     >>> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
>     >>>
>     >>>> Hi
>     >>>>
>     >>>> I am using filters (for taking care of Hibernate sessions) and it
>     >>>
>     >>>
>     >>> works
>     >>>
>     >>>> like a charm. However I did mess up initially because I forgot
>     to add
>     >>>> the correct mapping, which then resultet in the same behaviour.
>     >>>>
>     >>>> Make sure you have somthing like this in your web.xml file:
>     >>>>
>     >>>> <filter-mapping>
>     >>>> <filter-name><<your_filtername>></filter-name>
>     >>>> <url-pattern>/*</url-pattern>
>     >>>> </filter-mapping>
>     >>>>
>     >>>> Hermod
>     >>>>
>     >>>> -----Original Message-----
>     >>>> From: Bj�rn T Johansen [mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>]
>     >>>> Sent: Wednesday, May 04, 2005 1:43 PM
>     >>>> To: [email protected]
>     <mailto:[email protected]>
>     >>>> Subject: Servlet Filter?
>     >>>>
>     >>>>
>     >>>> I have a struts application where I am using Filter and Tomcat and
>     >>>
>     >>>
>     >>> this
>     >>>
>     >>>> works as it
>     >>>> should... But trying to do the same thing with a JSF application
>     >>>
>     >>>
>     >>> doesn't
>     >>>
>     >>>> work? Are
>     >>>> there something I am missing? The init() method is called, but
>     >>>
>     >>>
>     >>> doFilter
>     >>>
>     >>>> is never
>     >>>> called, why?
>     >>>>
>     >>>>
>     >>>> Regards,
>     >>>>
>     >>>> BTJ
>     >>>>
>     >>>
>     >>
>     >
> 

Reply via email to