Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to redirect to a logout page(How to redirect to a logout page)
How to redirect to a logout page [message #822526] Fri, 16 March 2012 15:52 Go to next message
Eclipse UserFriend
@Override
public void postShutdown() {
super.postShutdown();
final Display display = Display.getCurrent();
RWT.getLifeCycle().addPhaseListener(new PhaseListener() {

private static final long serialVersionUID = 1L;

public void afterPhase(final PhaseEvent event) {
if(Display.getCurrent() == null || display == Display.getCurrent()) {
try {
// Uses a non-public API, but currently this is the only solution
//HtmlResponseWriter writer = ContextProvider.getStateInfo().getResponseWriter();
final PrintWriter writer = RWT.getResponse().getWriter();





final String url = "html/logout.html";
writer.write("window.location.href=\'" + url + "\';");


RWT.getRequest().getSession().setMaxInactiveInterval(1);
} catch(final IOException e) {
e.printStackTrace();
}
RWT.getLifeCycle().removePhaseListener(this);
}
}

public PhaseId getPhaseId() {
return PhaseId.ANY;
}

public void beforePhase(final PhaseEvent event) {
};
});
}
Re: How to redirect to a logout page [message #822529 is a reply to message #822526] Fri, 16 March 2012 16:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Luis,

can you explain what you are trying to do? This will make it easier to answer.

If I guess: you want to invalidate the session and log the user out? I.e. something like a log-out button? Is that correct?

Thanks,
Elias.
Re: How to redirect to a logout page [message #822530 is a reply to message #822529] Fri, 16 March 2012 16:31 Go to previous messageGo to next message
Eclipse UserFriend
I.e. something like a log-out button
Re: How to redirect to a logout page [message #822536 is a reply to message #822530] Fri, 16 March 2012 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi Luis,

Your approach: session.setMaxInterval(1) is a good idea. However the PhaseListener is not appropriate (it gets called on every request!). Here is an example that uses a clickable "Logout" link.

Hope this helps,
Elias.
Re: How to redirect to a logout page [message #822537 is a reply to message #822536] Fri, 16 March 2012 17:15 Go to previous messageGo to next message
Eclipse UserFriend
But if it was on a toolbar for the User click out
Re: How to redirect to a logout page [message #822539 is a reply to message #822537] Fri, 16 March 2012 17:25 Go to previous messageGo to next message
Eclipse UserFriend
"html/logout.html";
Re: How to redirect to a logout page [message #822540 is a reply to message #822539] Fri, 16 March 2012 17:34 Go to previous message
Eclipse UserFriend
Hi Luis,

you would need to register that file first. See:

wiki.eclipse.org/RAP/FAQ#How_to_register_a_file.2Ffolder_as_resource.3F

Elias.
Previous Topic:Access the UI Thread in an ElementFactory
Next Topic:setIcon NullPointerException
Goto Forum:
  


Current Time: Sat Jun 14 20:51:08 EDT 2025

Powered by FUDForum. Page generated in 0.05116 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top