本文整理汇总了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);
}
}