You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Kerpe <An...@Kerpe.de> on 2011/04/30 17:48:18 UTC

back button when logged out

Hi,

i try to implement a logout feature like yahoo, squirrelmail, etc.
That means, when you klick "logout", you are redirected to a logout page.
When pressing the browsers back button, you are redirected to the login 
page again.

I've tried to implement that with:
@Inject
private Response response;
...
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma","no-cache");
etc.

but no luck, the above headers are *not* sended to the client.

Is there a simple way to implement the mentioned logout feature?

Thanks,
Andreas

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


SOLVED Re: back button when logged out

Posted by Andreas Kerpe <An...@Kerpe.de>.
Hi,

> This could look something like that (independent of caching - so you
> don't need to set headers):
>
> Layout.java (or a BasePage.java):
> Object onActionFromLogout()
> {
> loginService.logout();
> return Logout.class;
> }

the login-logout itself is running fine.

> Where do you add this two lines? This should work if you add the headers
> before content is sent. I just tried that with the quickstart archetype
> - I added the following lines to the Layout.java and it works:
> @Inject
> private Response response;
>
> @BeginRender
> public void addHeaders()
> {
> response.setHeader("Cache-Control", "no-cache");
> response.setHeader("Pragma","no-cache");
> }

That was the solution, i actually placed it in the wrong place, now its 
working fine!

Thanks a lot.

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


Re: back button when logged out

Posted by Christian Köberl <ta...@gmail.com>.
> i try to implement a logout feature like yahoo, squirrelmail, etc.
> That means, when you klick "logout", you are redirected to a logout page.
> When pressing the browsers back button, you are redirected to the login
> page again.

This could look something like that (independent of caching - so you 
don't need to set headers):

Layout.java (or a BasePage.java):
Object onActionFromLogout()
{
   loginService.logout();
   return Logout.class;
}

public Object onActivate()
{
   if(loginService.isAuthenticated())
     return this;
   else
    return Login.class;
}

> I've tried to implement that with:
> @Inject
> private Response response;
> ...
> response.setHeader("Cache-Control", "no-cache");
> response.setHeader("Pragma","no-cache");

Where do you add this two lines? This should work if you add the headers 
before content is sent. I just tried that with the quickstart archetype 
- I added the following lines to the Layout.java and it works:
@Inject
private Response response;

@BeginRender
public void addHeaders()
{
     response.setHeader("Cache-Control", "no-cache");
     response.setHeader("Pragma","no-cache");
}

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


Re: back button when logged out

Posted by ael <al...@dash.com.ph>.
Try SSO...

http://jumpstart.doublenegative.com.au/jumpstart/examples/state/sharingacrossmultiplepages1
http://jumpstart.doublenegative.com.au/jumpstart/examples/state/sharingacrossmultiplepages1 --
View this message in context: http://tapestry.1045711.n5.nabble.com/back-button-when-logged-out-tp4361320p4363685.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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