How to redirect to a logout page [message #822526] |
Fri, 16 March 2012 19:52 |
|
@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) {
};
});
}
Luís Carlos Moreira da Costa
Eclipse RAP, RCP, eRCP, GEF, EMF, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07528 seconds