本文整理匯總了Java中org.springframework.web.servlet.ModelAndView.getViewName方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelAndView.getViewName方法的具體用法?Java ModelAndView.getViewName怎麽用?Java ModelAndView.getViewName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.servlet.ModelAndView
的用法示例。
在下文中一共展示了ModelAndView.getViewName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: postHandle
import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
Long long1 = (Long) request.getAttribute(EXECUTE_TIME_ATTRIBUTE_NAME);
if (long1 == null) {
Long long2 = (Long) request.getAttribute(START_TIME_ATTRIBUTE_NAME);
Long long3 = Long.valueOf(System.currentTimeMillis());
long1 = Long.valueOf(long3.longValue() - long2.longValue());
request.setAttribute(START_TIME_ATTRIBUTE_NAME, long2);
}
if (modelAndView != null) {
String s = modelAndView.getViewName();
if (!StringUtils.startsWith(s, "redirect:"))
modelAndView.addObject(EXECUTE_TIME_ATTRIBUTE_NAME, long1);
}
if (logger.isDebugEnabled()) {
logger.debug((new StringBuilder("[")).append(handler).append("] executeTime: ").append(long1).append("ms").toString());
}
}
示例2: postHandle
import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
boolean isRedirectView = modelAndView!=null && modelAndView.getView() instanceof RedirectView;
// boolean isViewObject = modelAndView.getView() == null;
// if the view name is null then set a default value of true
boolean viewNameStartsWithRedirect = (modelAndView!=null && modelAndView.getViewName() == null ? true
: modelAndView!=null && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
if (modelAndView!=null && modelAndView.hasView() && !isRedirectView && !viewNameStartsWithRedirect) {
addCommonModelData(modelAndView);
}
}