try that as a workaround... crappy but working!
public void service(WebRequest request, WebResponse response, WebRequestServicer servicer) throws IOException { CookieSourceImpl cookieImpl = new CookieSourceImpl(); cookieImpl.setRequest(request); cookieImpl.setResponse(response); CookieSource cookies = (CookieSource) cookieImpl; // // use it here servicer.service(request, response); // More of my logic here } -----Ursprüngliche Nachricht----- Von: Denis Souza [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 6. Oktober 2005 20:01 An: 'Tapestry users' Betreff: Problem when using WebRequestServicerFilter Hi, In a previous post I asked about handling persistent cookies in Tapestry 4. I finally got it to work the way I want it by using my own implementation of CookieSource (which is much like Tapestry's own implementation, except for the persistent cookie part) and the cookie logic is handled by a class that implements WebRequestServicerFilter and is configured in hivemind to be be called on every request. So I have my own implementation of WebRequestServicerFilter. In order to work correctly my "service" method must look something like this: public void service(WebRequest request, WebResponse response, WebRequestServicer servicer) throws IOException { // Some of my logic here servicer.service(request, response); // More of my logic here } The "servicer.service(request, response)" call must be made so Tapestry can render the pages and do anything it needs to do. The problem seems to be that Tapestry's behavior differs in unexpected ways if I place my own code before or after the servicer.service() call. In this same class, I have injected an ApplicationStateManager object so that I can have access to the user's session. What happens is this: If I place any logic that accesses the session before the call to servicer.service(), I get a null pointer exception somewhere in the Tapestry code. Anyway, since in the first request, at this point, the session might not have been created yet, it's understandable that it may not work so I guess I'd just have to place this logic after the call to servicer.service(). This is where it gets strange: If I place cookie logic before the call, cookies work perfectly well, but if I place the cookie logic after the call, the cookies are not set in most of the requests! In this last case, cookies are only set sometimes in IE and never in Firefox. My problem is that my cookie logic requires that I access the session. If I place the logic before the call to "servicer.service()" I can't access the session. If I place it after the call, my cookies won't work. I have no idea why this is happening. I thought it might be a bug in which Tapestry does something to the request object after calling my WebRequestServicerFilter class or some servlet api restriction that I'm not aware of that requires you to se the cookies early. Anyone know what could be happening? Any ideas for a workaround? I'm using Tapestry 4 beta 9 Thanks, Denis --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]