How to make logout
public String onLogout() {
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
String url = ectx.getRequestContextPath() +
"/adfAuthentication?logout=true&end_url=/faces/loginpage.jspx";
try {
ectx.redirect(url);
} catch (IOException e) {
e.printStackTrace();
}
fctx.responseComplete();
return null;
}
public void logout(ActionEvent actionEvent) {
// Add event code here...
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
String url = ectx.getRequestContextPath()+"/faces/loginpage.jspx";
HttpSession session = (HttpSession)ectx.getSession(false);
session.invalidate();
try {
response.sendRedirect(url);
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
System.out.println(e.getMessage());
}
return;
}
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
String url = ectx.getRequestContextPath() +
"/adfAuthentication?logout=true&end_url=/faces/loginpage.jspx";
try {
ectx.redirect(url);
} catch (IOException e) {
e.printStackTrace();
}
fctx.responseComplete();
return null;
}
public void logout(ActionEvent actionEvent) {
// Add event code here...
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
String url = ectx.getRequestContextPath()+"/faces/loginpage.jspx";
HttpSession session = (HttpSession)ectx.getSession(false);
session.invalidate();
try {
response.sendRedirect(url);
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
System.out.println(e.getMessage());
}
return;
}
Comments