Thanks for all your responses! I'm doing my own implementation of CookieSource and with a bit more of reading I learned how to hook to the WebRequestServicerFilter through hivemind. I got most of it working already.
Denis -----Original Message----- From: Eli Doran [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 3 de outubro de 2005 22:18 To: Tapestry users Subject: Re: Persistent cookies in T4 I use an enhanced version of the CookieSource implementation. I just create it as a service using my implementation and use that in my pages, components and services. You can do that until the framework provides what you want. I put it in my hivemodule like this: <service-point id="CookieSource" interface="com.elidoran.tapestry.CookieSource"> <invoke-factory> <construct class="com.elidoran.tapestry.DefaultCookieSource"> <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/> <set-service property="response" service-id="tapestry.globals.HttpServletResponse"/> </construct> </invoke-factory> </service-point> To see the source changes I made you can check out the patch I provided for the standard classes here: http://issues.apache.org/jira/browse/TAPESTRY-419. I've been using the enhancement through many of the beta versions and had no problems. I use it in a persistence strategy that persists properties to cookies. The framework compiles and runs fine with the changes. ~eli Shawn Church wrote: 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]