类org.springframework.web.servlet.ModelAndViewDefiningException源码实例Demo

下面列出了怎么用org.springframework.web.servlet.ModelAndViewDefiningException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: oslits   文件: AuthenticInterceptor.java
/**
 * 세션에 계정정보(LoginVO)가 있는지 여부로 인증 여부를 체크한다.
 * 계정정보(LoginVO)가 없다면, 로그인 페이지로 이동한다.
 */
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

	boolean isPermittedURL = false;

	LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

	if(loginVO != null){
		return true;
	} else if(!isPermittedURL){
			ModelAndView modelAndView = new ModelAndView("redirect:/uat/uia/egovLoginUsr.do");
			throw new ModelAndViewDefiningException(modelAndView);
		}else{
			return true;
		}
}
 
源代码2 项目: jpetstore-kubernetes   文件: SignonInterceptor.java
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws Exception {
	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;
	}
}
 
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
	UserSession userSession = (UserSession) request.getSession().getAttribute("userSession");
	Cart cart = (Cart) request.getSession().getAttribute("sessionCart");
	if (cart != null) {
		// Re-read account from DB at team's request.
		Account account = this.petStore.getAccount(userSession.getAccount().getUsername());
		OrderForm orderForm = new OrderForm();
		orderForm.getOrder().initOrder(account, cart);
		return orderForm;
	}
	else {
		ModelAndView modelAndView = new ModelAndView("Error");
		modelAndView.addObject("message", "An order could not be created because a cart could not be found.");
		throw new ModelAndViewDefiningException(modelAndView);
	}
}
 
源代码4 项目: cacheonix-core   文件: SignonInterceptor.java
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws Exception {
	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;
	}
}
 
源代码5 项目: cacheonix-core   文件: OrderFormController.java
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
	UserSession userSession = (UserSession) request.getSession().getAttribute("userSession");
	Cart cart = (Cart) request.getSession().getAttribute("sessionCart");
	if (cart != null) {
		// Re-read account from DB at team's request.
		Account account = this.petStore.getAccount(userSession.getAccount().getUsername());
		OrderForm orderForm = new OrderForm();
		orderForm.getOrder().initOrder(account, cart);
		return orderForm;
	}
	else {
		ModelAndView modelAndView = new ModelAndView("Error");
		modelAndView.addObject("message", "An order could not be created because a cart could not be found.");
		throw new ModelAndViewDefiningException(modelAndView);
	}
}
 
源代码6 项目: pinpoint   文件: AuthInterceptor.java
private void throwAuthException(String message) throws ModelAndViewDefiningException {
    logger.warn(message);
    throw new ModelAndViewDefiningException(ControllerUtils.createJsonView(false, message));
}
 
 类方法
 同包方法