You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Oswaldo V. C. Bueno" <bu...@carpintaria.com> on 2006/06/26 23:18:04 UTC

Handling cookies in Tapestry

Hello,
	I'm a developer moving from WebObjects to Tapestry/Cayenne platform.

	I'd like to know the best aproach in Tapestry to handle a Cookie  
containing the visitor information.

	In webobjects I had in Session.java (equivalent to Visit.java):


     public void awake() {
		super.awake();
		verifyVisitorCookie(context().request().cookieValueForKey 
("visitorCookieForMySite"))
     }

     public void appendToResponse(WOResponse aResponse, WOContext  
aContext) {
		super.appendToResponse(aResponse, aContext);
		renewVisitorCookie(aResponse);
     }

	This way I could get the cookie information and initialize my  
visitor information whatever url was used to enter the website.

	But I belive in Tapestry it is done by another aproach, maybe using  
hivemind.

Thanks for any assistance,

Bueno



_____________________________________________
Oswaldo V. C. Bueno - mailto:bueno@carpintaria.com
Technology - Phone: 55+11+3078+8557
Carpintaria do Software - http://www.carpintaria.com



Re: Handling cookies in Tapestry

Posted by Bryan Lewis <br...@maine.rr.com>.
Welcome.  Tapestry/Cayenne is a fine replacement for WebObjects.

Tapestry's class for cookie handling is the CookieSource.
http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapestry/services/CookieSource.html

For example, we have a little method in our Visit class:

    public void doCookieLogin(IRequestCycle cycle) {
        CookieSource oven = cycle.getInfrastructure().getCookieSource();
        String loginName = oven.readCookieValue("YourLoginNameKey");
        //...
    }




Oswaldo V. C. Bueno wrote:

> Hello,
>     I'm a developer moving from WebObjects to Tapestry/Cayenne platform.
>
>     I'd like to know the best aproach in Tapestry to handle a Cookie 
> containing the visitor information.
>
>     In webobjects I had in Session.java (equivalent to Visit.java):
>
>
>     public void awake() {
>         super.awake();
>         verifyVisitorCookie(context().request().cookieValueForKey
> ("visitorCookieForMySite"))
>     }
>
>     public void appendToResponse(WOResponse aResponse, WOContext 
> aContext) {
>         super.appendToResponse(aResponse, aContext);
>         renewVisitorCookie(aResponse);
>     }
>
>     This way I could get the cookie information and initialize my 
> visitor information whatever url was used to enter the website.
>
>     But I belive in Tapestry it is done by another aproach, maybe
> using  hivemind.
>
> Thanks for any assistance,
>
> Bueno
>
>
>
> _____________________________________________
> Oswaldo V. C. Bueno - mailto:bueno@carpintaria.com
> Technology - Phone: 55+11+3078+8557
> Carpintaria do Software - http://www.carpintaria.com
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org