Sorry guys, I found the problem.

I had disabled cookies on the webapp.

Surely this is a bug in t5 ...
in that with cookies disabled, an ajax form submit acquires a new session every time?

Regards, p.

Paul Stanton wrote:
Here is a concrete example which I've constructed separate to the rest of my app to exclude any quirks intruduced by it's complexity:
----------------------------
public class Start
{
   private final static Logger LOG = Logger.getLogger(Start.class);
   @Inject
   private ComponentResources resources;
   @Inject
   @Property
   private HttpServletRequest httpRequest;

   Object onSuccessFromMyForm()
   {
       LOG.debug(httpRequest.getSession().getId());
return new MultiZoneUpdate("myZone", resources.getEmbeddedComponent("myZone"));
   }
}
-------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; xmlns:p="tapestry:parameter">
   <head>
   </head>
   <body>
   <t:form t:id="myForm" t:zone="myZone">
       <input type="submit" />
   </t:form>
   <t:zone t:id="myZone">
       ${httpRequest.session.id}
   </t:zone>
   </body>
</html>
------------------------------

Paul Stanton wrote:
Actually, the 2nd request (which clears the session) is not a manually created Ajax.Request. Sorry for the confusion.

It's actually a async form submit, and to simplify the issue somewhat every submit of this form prints a different sessionId:

   <t:form t:id="someForm" t:zone="someZone">
       <input t:type="TextField" t:id="someInput" />
       <input type="submit" value="search" />
   </t:form>

   @Inject
   private HttpServletRequest request;

   Object onSuccessFromSomeForm()
   {
LOG.debug("onSuccessFromSomeForm " + httpRequest.getSession().getId());
       return null;
   }

Surely that can't be correct?

p.

Paul Stanton wrote:
Thiago,

I tried with @SessionState(create=false) and the same occurs (testing the field for null).

I also tried (as a sanity check) to inject HttpRequest and manage the session attribute manually. Interestingly, the session Id is changing!

This must be the cause - somehow my manual Ajax.Request to a url derived from resources.createEventLink().toAbsoluteURI() is creating a new session....

p.

Thiago H. de Paula Figueiredo wrote:
On Thu, 27 May 2010 23:32:38 -0300, Paul Stanton <p...@mapshed.com.au> wrote:

Hi Thiago,

Hi!

please bare with me... I'm not imagining it. I'm guessing it's something to do with my manually created ajax request...

Tapestry's session handling works the same regardless how the request was made.

I'm not inspecting via debugger, I'm testing the value of the field in code, ie:

via @Persist("session")
if (persistentField == null) LOG.debug("state reset");

I don't know if that's the case, but a persistent field from a given page is only accessible in the same page, even when some other page has a similar field.

and via the @SessionState
if (!persistentFieldExists) LOG.debug("state reset");

Use @SessionState(create = false) instead and test for null.


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



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



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



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

Reply via email to