The below code is required for logout in ADF applications.
public String logOut() throws
IOException{
HttpSession session = null;
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
session = (HttpSession)ectx.getSession(false);
HttpServletResponse response = (HttpServletResponse)ectx.getResponse(); String currentPage = "faces/login.jspx";
String url = ectx.getRequestContextPath()+"/adfAuthentication?logout=true&end_url=" + currentPage;
try {
response.sendRedirect(url);
session.invalidate();
} catch (Exception ex) {
ex.printStackTrace();
}
fctx.responseComplete();
return null;
}
HttpSession session = null;
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
session = (HttpSession)ectx.getSession(false);
HttpServletResponse response = (HttpServletResponse)ectx.getResponse(); String currentPage = "faces/login.jspx";
String url = ectx.getRequestContextPath()+"/adfAuthentication?logout=true&end_url=" + currentPage;
try {
response.sendRedirect(url);
session.invalidate();
} catch (Exception ex) {
ex.printStackTrace();
}
fctx.responseComplete();
return null;
}
Thanks...
No comments:
Post a Comment