You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ezra Epstein <ee...@prajnait.com> on 2004/03/09 01:22:39 UTC

stateless (stateful='false') Form component throws Stale session

I'm a bit stuck implementing a login screen.  In particular, what
incantations are needed at logout to tell Tapestry to stop complaining about
no session being present at next login.  I've already specified
stateful="false" for the form:

	<form jwcid="@Form" listener="ognl:listeners.login" stateful="false"
delegate="ognl:beans.delegate">

But every time I logout I get the stale session error page.  I pretty much
copied what vlib does for logout.  But, unlike vlib, we return users
directly to the login screen.

	public void logoff(IRequestCycle cycle)
	{
		IMessageProperty home = (IMessageProperty) cycle.getPage("Home");
		home.setMessage("Logged Out");
		cycle.activate(home);

		Engine myEngine = (Engine) getPage().getEngine();
		myEngine.logout();
	}

In our engine:

	public void logout()
	{
		_killSession = true;
	}

	protected void cleanupAfterRequest(IRequestCycle cycle)
	{
		super.cleanupAfterRequest(cycle);

		if (_killSession)
		{
			try
			{
				HttpSession session = cycle.getRequestContext().getSession();

				if (session != null)
					session.invalidate();
			}
			catch (IllegalStateException ex)
			{
				// Ignore.
			}
		}
	}

Any pointers?

Thanks,
  == EE


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


Re: stateless (stateful='false') Form component throws Stale session

Posted by Bryan Lewis <br...@maine.rr.com>.
If you search for "invalidate" in the list you'll find several postings
on this topic.  This one about engine.restart() was helpful to me:

http://article.gmane.org/gmane.comp.java.tapestry.user/3676/match=invalidate


----- Original Message ----- 
From: "Ezra Epstein" <ee...@prajnait.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, March 08, 2004 7:22 PM
Subject: stateless (stateful='false') Form component throws Stale
session


> I'm a bit stuck implementing a login screen.  In particular, what
> incantations are needed at logout to tell Tapestry to stop complaining
about
> no session being present at next login.  I've already specified
> stateful="false" for the form:
>
> <form jwcid="@Form" listener="ognl:listeners.login" stateful="false"
> delegate="ognl:beans.delegate">
>
> But every time I logout I get the stale session error page.  I pretty
much
> copied what vlib does for logout.  But, unlike vlib, we return users
> directly to the login screen.
>
> public void logoff(IRequestCycle cycle)
> {
> IMessageProperty home = (IMessageProperty) cycle.getPage("Home");
> home.setMessage("Logged Out");
> cycle.activate(home);
>
> Engine myEngine = (Engine) getPage().getEngine();
> myEngine.logout();
> }
>
> In our engine:
>
> public void logout()
> {
> _killSession = true;
> }
>
> protected void cleanupAfterRequest(IRequestCycle cycle)
> {
> super.cleanupAfterRequest(cycle);
>
> if (_killSession)
> {
> try
> {
> HttpSession session = cycle.getRequestContext().getSession();
>
> if (session != null)
> session.invalidate();
> }
> catch (IllegalStateException ex)
> {
> // Ignore.
> }
> }
> }
>
> Any pointers?
>
> Thanks,
>   == EE
>
>
> ---------------------------------------------------------------------
> 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


RE: stateless (stateful='false') Form component throws Stale session

Posted by Ezra Epstein <ee...@prajnait.com>.
> But every time I logout 

and log back in again

> I get the stale session error page.  I pretty much
> 

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