Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 49381 invoked from network); 18 Jan 2006 04:44:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Jan 2006 04:44:40 -0000 Received: (qmail 39486 invoked by uid 500); 18 Jan 2006 04:44:35 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 39443 invoked by uid 500); 18 Jan 2006 04:44:35 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 39428 invoked by uid 99); 18 Jan 2006 04:44:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2006 20:44:35 -0800 X-ASF-Spam-Status: No, hits=3.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [68.142.198.210] (HELO smtp111.sbc.mail.mud.yahoo.com) (68.142.198.210) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 17 Jan 2006 20:44:33 -0800 Received: (qmail 30031 invoked from network); 18 Jan 2006 04:44:09 -0000 Received: from unknown (HELO MOE) (frohman@pacbell.net@209.233.19.235 with login) by smtp111.sbc.mail.mud.yahoo.com with SMTP; 18 Jan 2006 04:44:09 -0000 Reply-To: From: To: "'MyFaces Discussion'" Subject: RE: Servlet Filter? Date: Tue, 17 Jan 2006 20:44:17 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcVRilcva6rRBgA3RVaBZK626tnQMDKX3yYg In-Reply-To: <427A40AA.1070201@havleik.no> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Checked: Checked by ClamAV on apache.org Message-Id: <20060118044434.6866B10FB0A5@asf.osuosl.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N =20 -----Original Message----- From: Bj=F8rn T Johansen [mailto:btj@havleik.no]=20 Sent: Thursday, May 05, 2005 8:50 AM To: MyFaces Discussion Subject: Re: Servlet Filter? Yes, you are correct... And after changing my url-pattern back to /protected/* it works like it should.... And what you say about the url, makes sense.... So thx! :) BTJ Matt Blum wrote: > You need to change your url-mapping back to "/protected/*". I'm=20 > assuming you left it mapped to "/*", in which case the behavior you're = > describing is what you *should* be seeing. The filter is being called = > twice now, once for the initial request (logins.jsp) and once for the=20 > forward (/protected/index.jsp). The URL you're printing out is coming = > from the request object, which will only give you the URL that was=20 > originally sent to the server. >=20 > That's the difference between a redirect and a forward: a redirect=20 > instructs the client to request a different URL from the server, which = > thereby creates a new request object; a forward is handled entirely on = > the server, with the server simply redirecting the *handling* of the=20 > request to something other than what was initially requested. >=20 > -Matt >=20 > On 5/5/05, *Bj=F8rn T Johansen* > > wrote: >=20 > Well, I tried switching to 2.4 spec, but the only difference (I > enabled requests and > forwards), is that it now prints the url twice (i.e. the doFilter > method is called twice), > but it still just shows me the url for the previous page ( i.e. > /logins.jsp instead of > /protected/index.jsp but the page shown is /protected/index.jsp) > Is there something fundamental I am missing...? This is my first = JSF > app, but it shouldn't > be that much different from say Struts... >=20 > BTJ >=20 > Matt Blum wrote: > > OK, now I think I've got it: > > > > The navigation rule is doing a forward, not a redirect. Servlet > filters > > don't always handle anything but the initial server request. If > you're > > using a servlet container that only supports up to servlet spec > 2.3, it > > will *only* handle the initial server request, so I'm not sure = how > you'd > > fix your problem. If you're using one that supports servlet = spec 2.4, > > though, you can configure it to handle requests, forwards, > includes, and > > errors as follows: > > > > > > MyFilter > > > > REQUEST > > > > FORWARD > > INCLUDE > > ERROR > > > > > > > > Obviously, if you only want it to handle requests and forwards, > you only > > need the corresponding lines. > > > > Hope this helps. > > -Matt > > > > On 5/4/05, *Bj=F8rn T Johansen* >> > > wrote: > > > > 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..: > > > > > > /login.jsp > > > > success > > /protected/index.jsp > > > > > > > > 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=F8rn T Johansen* > > > > > >>> > > > 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/.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=F8rn T = Johansen" < > > > btj@havleik.no > > btj@havleik.no > > >>> > > > > To: "MyFaces Discussion" < users@myfaces.apache.org > > > > > > > > > >>> > > > > 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 > > > >> > > > >> hermod.opstvedt@dnbnor.no > > > > > > > >> 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=F8rn T Johansen [mailto: btj@havleik.no > > > > > > > = btj@havleik.no >>] > > > >>> 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 > > > >>> > > > >>> hermod.opstvedt@dnbnor.no > > > > > hermod.opstvedt@dnbnor.no > >> 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: > > > >>>> > > > >>>> > > > >>>> <> > > > >>>> /* > > > >>>> > > > >>>> > > > >>>> Hermod > > > >>>> > > > >>>> -----Original Message----- > > > >>>> From: Bj=F8rn T Johansen [mailto: btj@havleik.no > > > > > > > > >>] > > > >>>> Sent: Wednesday, May 04, 2005 1:43 PM > > > >>>> To: myfaces-user@incubator.apache.org > > > > > > > > > >> > > > >>>> 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 > > > >>>> > > > >>> > > > >> > > > > > > > > > > > >=20 >=20