You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Arvind Pandey <ar...@datamatics.com> on 2007/07/05 07:45:03 UTC

Session Time out problem

Hi all!

     My requirement is like this:

	i)  If user will try to access any direct URL then the page should be
redirected to login page.
	ii) After session time out if user will click on any link/button then the
page should be
	    redirected to session expire page.

	For these requirements i have used filter in my code,

	public void doFilter(ServletRequest request, ServletResponse response,
	    FilterChain chain) throws IOException, ServletException {

		String page = "/sessionExpire.jsf";

		HttpServletRequest req = (HttpServletRequest) request;

		if (req.getSession().isNew()) {
		RequestDispatcher rd = request.getRequestDispatcher(page);
		rd.forward(request, response);
	    } else {
		chain.doFilter(request, response);
	    }
	}

	I am checking the condition req.getSession().isNew() because after session
time out if
user will click some where then one new session is get created.
But how can i implement my reqirement i) ?

     Any suggestion will be appreciated.
     Thanks...
regards
Arvind Pandey

Disclaimer: The information contained in this e-mail and attachments if any are privileged and confidential and are intended for the individual(s) or entity(ies) named in this e-mail. If the reader or recipient is not the intended recipient, or employee or agent responsible for delivering to the intended recipient, you are hereby notified that dissemination, distribution or copying of this communication or attachments thereof is strictly prohibited. IF YOU RECEIVE this communication in error, please immediately notify the sender and return the original message.