FileDocCategorySizeDatePackage
SignonInterceptor.javaAPI DocExample1299Sun Jan 04 23:43:42 GMT 2004org.springframework.samples.jpetstore.web.spring

SignonInterceptor

public class SignonInterceptor extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
author
Juergen Hoeller
since
01.12.2003
version
$Id: SignonInterceptor.java,v 1.4 2004/01/04 23:43:41 jhoeller Exp $

Fields Summary
Constructors Summary
Methods Summary
public booleanpreHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)

		UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession");
		if (userSession == null) {
			String url = request.getServletPath();
			String query = request.getQueryString();
			ModelAndView modelAndView = new ModelAndView("SignonForm");
			if (query != null) {
				modelAndView.addObject("signonForwardAction", url+"?"+query);
			}
			else {
				modelAndView.addObject("signonForwardAction", url);
			}
			throw new ModelAndViewDefiningException(modelAndView);
		}
		else {
			return true;
		}