Java Code Examples for javax.faces.context.ExternalContext#invalidateSession()

The following examples show how to use javax.faces.context.ExternalContext#invalidateSession() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthBean.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
public void logout() throws IOException {
	ExternalContext externalContext = FacesContext.getCurrentInstance()
			.getExternalContext();
	externalContext.invalidateSession();
	externalContext.redirect(externalContext.getRequestContextPath()
			+ "/index.xhtml");
	externalContext.getSessionMap().remove(BeanUtil.KEY_USER);
}
 
Example 2
Source File: SessionScopeBean.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private synchronized void logout(String redirectUrlBase64) {
	ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
	HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
	StringBuilder url = new StringBuilder(Urls.LOGIN.toString(request));
	url.append("?");
	url.append(GetParamNames.REFERER);
	url.append("=");
	url.append(redirectUrlBase64);
	externalContext.invalidateSession();
	try {
		externalContext.redirect(url.toString());
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
Example 3
Source File: UserMB.java    From ipst with Mozilla Public License 2.0 4 votes vote down vote up
public void logOut() throws IOException {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    ec.invalidateSession();
    ec.redirect(ec.getRequestContextPath() + "/index.jsf");
}