You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org> on 2006/12/19 23:55:23 UTC

[jira] Resolved: (TAPESTRY-825) Cookies failing due to improper timing on flush() method

     [ http://issues.apache.org/jira/browse/TAPESTRY-825?page=all ]

Jesse Kuhnert resolved TAPESTRY-825.
------------------------------------

    Resolution: Fixed
      Assignee: Jesse Kuhnert

Made sure flush() calls happen just before any content is rendered (in all modes) . 

> Cookies failing due to improper timing on flush() method
> --------------------------------------------------------
>
>                 Key: TAPESTRY-825
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-825
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>            Reporter: Eli Doran
>         Assigned To: Jesse Kuhnert
>             Fix For: 4.1.2
>
>
> >> I believe I intended the flush() method to be the one that actually
> >> writes the cookies out. The intent being to assemble a map of cookie
> >> keys and values and write those cookies out inside flush().
> >> 
> >> However, the timing is completely wrong!  The flush() is called even
> >> aftter the request cycle is cleaned up, far too late.  It should occur
> >> from inside the ResponseRenderer service.  Please add a bug.
> >> On 12/30/05, Eli Doran <el...@gmail.com> wrote:
> >> To add more info...
> >>
> >> I added a bit to make sure it was the timing. I set the cookie scope
> >> manager into a cart subclass and when done using it in the listener
> >> method i called the manager's store method on it. Of course store gets
> >> called again by the system a bit after but by then the cart is not dirty
> >> and so it returns without doing any store stuff. However, the store
> >> works when run earlier than the system defined time. Any way to alter that?
> >>
> >> So, where to dig to find what handles calling store on the
> >> StateObjectPersistenceManagers? I'll look more tomorrow but if anyone
> >> has some thoughts on this I'd be interested in hearing it.
> >>
> >> ~eli
> >>
> >> Eli Doran wrote:
> >>
> >
> >>> > I've been trying to setup a new scope for ASO's using cookies. I have
> >>> > the ASO working fine and injecting into pages.
> >>> >
> >>> > The problem is by the time the system calls
> >>> > StateObjectPersistenceManager#store for the cookie manager it seems to
> >>> > be too late to add cookies to the outgoing response. I checked it
> >>> > wasn't the ASO by setting a simple cookie like:
> >>> > cookieSource.writeCookieValue("store", "value"); in the store method
> >>> > and it doesn't get stored. I'm using CookieSource injected into the
> >>> > cookie ASO manager.
> >>> >
> >>> > Does anyone see a way around this problem? Or am I getting it wrong
> >>> > somehow?
> >>> >
> >>> > Checking through my logs it shows the listener method beginning, the
> >>> > cookie scope manager being accessed where it sets a test cookie,
> >>> > creates the ASO and returns it, work in the listener is done and the
> >>> > listener method returns, then the cookie scope manager is called to
> >>> > store the ASO, which it runs through writing another simple cookie as
> >>> > well as the ASO cookie and returns and finally the servlet's service
> >>> > method completes. The test cookie in the "get the ASO" method is
> >>> > available in the browser but the cookies written during the "store the
> >>> > ASO" are not. This seems to prevent the possibility of a working
> >>> > cookie ASO scope.
> >>> >
> >>> > I managed to setup a property persistence strategy that persists the
> >>> > property object to a Cookie which manages to do the storing in time.
> >>> > This works fine but when that object needs to be available to multiple
> >>> > pages it'd be nicer to use an ASO than load the page with the
> >>> > persistent property whenever it is needed.
> >>> >
> >>> > What'd you think?
> >>> >
> >>> > ~eli
> >>> >
> >>> >
> >>> > This is my log...note the empty 'object' value for CookieScopeManager
> >>> > on line #7 is an empty cart whose toString() produces an empty string.
> >>> >
> >>> > 1. 2005/12/31 01:26:46.531  TRACE [http-8888-Processor5]
> >>> > TapestryServlet >>> service(ServletRequest, ServletResponse)
> >>> > 2. 2005/12/31 01:26:57.171  TRACE [http-8888-Processor5] ReleasePage
> >>
> >>>>>> > >>> doAddToCart()
> >>
> >>> > 3. 2005/12/31 01:26:57.328  TRACE [http-8888-Processor5]
> >>> > CookieScopeManager >*< CookieScopeManager()
> >>> > 4. 2005/12/31 01:26:57.359  TRACE [http-8888-Processor5]
> >>> > CookieScopeManager >>> get(String,StateObjectFactory)
> >>> > 5. 2005/12/31 01:26:57.359  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === objectName = cart
> >>> > 6. 2005/12/31 01:26:57.359  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === factory = <SingletonProxy for
> >>> > website.state.CartBuilder(org.apache.tapestry.engine.state.StateObjectFactory)>
> >>> >
> >>> > 7. 2005/12/31 01:26:57.406  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === object =
> >>> > 2005/12/31 01:26:57.406  TRACE [http-8888-Processor5]
> >>> > CookieScopeManager <<< get(String,StateObjectFactory)
> >>> > 2005/12/31 01:26:58.000  TRACE [http-8888-Processor5] ReleasePage <<<
> >>> > doAddToCart()
> >>> > 2005/12/31 01:26:58.015  TRACE [http-8888-Processor5]
> >>> > CookieScopeManager >>> store(String,Object)
> >>> > 2005/12/31 01:26:58.015  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === objectName = cart
> >>> > 2005/12/31 01:26:58.015  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === stateObject = 204-205_2-206_3
> >>> > 2005/12/31 01:26:58.015  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === dirty = true
> >>> > 2005/12/31 01:26:58.031  DEBUG [http-8888-Processor5]
> >>> > CookieScopeManager === cookieValue =
> >>> > ZH4sIAAAAAAAAAFvzloG1uIhBMjk/Vy81JzMlvygxTy85sahEzzexwBlI/2FkOxfCUirPw8BQUVDOwsDAwAxUL5iVWJaol5OYl67nmVeSmp5aJPRowZLvje0WTAyMngysZYk5pakVRQwCCHV+pblJqUVta6bKck950M0EMg5o2BmwkYzFhQx1DEAxhrNgPhOcf66cA2TlfyCoAAAIrQA+rAAAAA==
> >>> >
> >>> > 2005/12/31 01:26:58.031  TRACE [http-8888-Processor5]
> >>> > CookieScopeManager <<< store(String,Object)
> >>> > 2005/12/31 01:26:58.031  TRACE [http-8888-Processor5] TapestryServlet
> >>> > <<< service(ServletRequest, ServletResponse)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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