Using Annotations, this has worked for me:

   @InjectObject("service:tapestry.request.CookieSource")
      public abstract CookieSource getCookieSource();

and then:

getCookieSource().readCookieValue(name);

or 

getCookieSource().writeCookieValue(name, value);

One limitation is that writeCookieValue does not yet handle expiration
dates (according to the TODO: in CookieSource.java).

The second part of your question would involve hooking into one of the
HiveMind engine services involved in handling each request (possibly
Tapestry.request.WebRequestServicer).  In Tapestry 3, it was a simple
matter of overriding BaseEngine and implementing setupForRequest().

Shawn


Quoting Denis Souza <[EMAIL PROTECTED]>:

> Hi,
> 
>  
> 
> I'm trying to create a persistent cookie to be placed in the user's
> browser
> but I just can't figure out how to do it in Tapestry 4. I've looked
> around
> in the list archives and in the docs but I couldn't find anything
> that would
> help me (except for the CookieSource class which didn't seem very
> helpful in
> my case). Anyone know how this can be done?
> 
>  
> 
> Another thing is that for every request I must read this cookie and
> update
> my database with some info (regardless of which page the user is
> accessing)
> and on every response I might have to change the cookie's contents.
> How
> would I go about having a class/method that is called on every
> request/response so that I can read/update this information? I'm
> thinking
> it's some hivemind thing but I guess I'm just not fluent enough with
> it yet.
> Can somebody help me?
> 
>  
> 
> Thanks,
> 
> Denis Souza
> 
>  
> 
> 




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

Reply via email to