You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Howard M. Lewis Ship" <hl...@attbi.com> on 2003/03/24 18:51:23 UTC

RE: Strange problem with cycle attributes

Yes, that is true.  The RequestCycle attributes are cleared at the end of
the render (including the rewind phase, which is like a render).

You can access, through Tapestry, the Servlet API and store this as an
HttpServletRequest attribute, which will give it the right lifecycle.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Luke Galea [mailto:lgalea@bluecatnetworks.com] 
> Sent: Tuesday, February 11, 2003 3:54 PM
> To: malcolm_edgar@bigpond.com; Tapestry users
> Subject: RE: Strange problem with cycle attributes
> 
> 
> Actually.. I think my problem is that when I move from one 
> page to another within a single request it seems to reset the 
> attributes..
> 
> Luke Galea 
> Software Development
> BlueCat Networks
> 905-762-5225
>  
> 
> -----Original Message-----
> From: Malcolm Edgar [mailto:malcolm_edgar@bigpond.com] 
> Sent: February 11, 2003 3:35 PM
> To: Tapestry users; tapestry-user@jakarta.apache.org
> Subject: Re: Strange problem with cycle attributes
> 
> Hi Luke,
> 
> a request cycle attribute will only be stored for the 
> duration of the HTTP 
> request and response, and will not be available on subsequent 
> requests. Is 
> this how your code is working?
> 
> At 10:09 AM 11/02/2003 -0500, Luke Galea wrote:
> >Hello,
> >
> >I am trying to associate an object with a single request.. and I am 
> >doing so by setting an attribute in the request cycle.
> >
> >I am experiencing some strangeness.. namely that it doesn't 
> seem to be 
> >storing my setting.
> >
> >Below is my code.. And as far as I can tell, it should never say "No 
> >Session Found" more than once for a given request...  but it is doing
> so
> >for each call... Is there something I am doing wrong?
> >
> >public synchronized Session getSession() throws SQLException
> >     {
> >         Object session = getRequestCycle().getAttribute( 
> >REQUEST_ATTRIBUTE );
> >
> >         if( session == null )
> >         {
> >             log.debug( "No Session Found! Creating New!!" );
> >
> >             session = Persistor.getSessionFactory().openSession();
> >
> >             assert session != null;
> >
> >             getRequestCycle().setAttribute( 
> REQUEST_ATTRIBUTE, session 
> >);
> >
> >           }
> >
> >             return (Session) session;
> >}
> >
> >Thanks in advance.
> >
> >Luke Galea
> >Software Development
> >BlueCat <http://www.bluecatnetworks.com/>  Networks 905-762-5225
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>