本文整理了Java中org.springframework.web.servlet.ModelAndView.getStatus()
方法的一些代码示例,展示了ModelAndView.getStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ModelAndView.getStatus()
方法的具体详情如下:
包路径:org.springframework.web.servlet.ModelAndView
类名称:ModelAndView
方法名:getStatus
[英]Return the configured HTTP status for the response, if any.
[中]返回响应的已配置HTTP状态(如果有)。
代码示例来源:origin: spring-projects/spring-framework
if (mv.getStatus() != null) {
response.setStatus(mv.getStatus().value());
代码示例来源:origin: org.springframework/spring-webmvc
if (mv.getStatus() != null) {
response.setStatus(mv.getStatus().value());
代码示例来源:origin: spring-projects/spring-framework
@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
if (returnValue == null) {
mavContainer.setRequestHandled(true);
return;
}
ModelAndView mav = (ModelAndView) returnValue;
if (mav.isReference()) {
String viewName = mav.getViewName();
mavContainer.setViewName(viewName);
if (viewName != null && isRedirectViewName(viewName)) {
mavContainer.setRedirectModelScenario(true);
}
}
else {
View view = mav.getView();
mavContainer.setView(view);
if (view instanceof SmartView && ((SmartView) view).isRedirectView()) {
mavContainer.setRedirectModelScenario(true);
}
}
mavContainer.setStatus(mav.getStatus());
mavContainer.addAllAttributes(mav.getModel());
}
代码示例来源:origin: org.springframework/spring-webmvc
@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
if (returnValue == null) {
mavContainer.setRequestHandled(true);
return;
}
ModelAndView mav = (ModelAndView) returnValue;
if (mav.isReference()) {
String viewName = mav.getViewName();
mavContainer.setViewName(viewName);
if (viewName != null && isRedirectViewName(viewName)) {
mavContainer.setRedirectModelScenario(true);
}
}
else {
View view = mav.getView();
mavContainer.setView(view);
if (view instanceof SmartView && ((SmartView) view).isRedirectView()) {
mavContainer.setRedirectModelScenario(true);
}
}
mavContainer.setStatus(mav.getStatus());
mavContainer.addAllAttributes(mav.getModel());
}
代码示例来源:origin: com.github.jerryxia/devhelper
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor
// org.springframework.web.servlet.ModelAndView
if (this.enabled) {
if (modelAndView == null) {
if (log.isDebugEnabled()) {
log.debug("ModelAndView returned: null");
}
} else {
StringBuffer sb = new StringBuffer(256);
appendKeyValueLine(sb, "ModelAndView returned", "");
if (modelAndView.getStatus() == null) {
appendSeperateKeyValueLine(sb, "status", null);
} else {
appendSeperateKeyValueLine(sb, "status", modelAndView.getStatus().toString(),
modelAndView.getStatus().getReasonPhrase());
}
appendSeperateKeyValueLine(sb, "view", modelAndView.getViewName());
appendSeperateKeyValueLine(sb, "model", modelAndView.getModelMap().toString());
if (log.isDebugEnabled()) {
log.debug(sb.toString());
}
}
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public void handleReturnValue(Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
if (returnValue == null) {
mavContainer.setRequestHandled(true);
return;
}
ModelAndView mav = (ModelAndView) returnValue;
if (mav.isReference()) {
String viewName = mav.getViewName();
mavContainer.setViewName(viewName);
if (viewName != null && isRedirectViewName(viewName)) {
mavContainer.setRedirectModelScenario(true);
}
}
else {
View view = mav.getView();
mavContainer.setView(view);
if (view instanceof SmartView) {
if (((SmartView) view).isRedirectView()) {
mavContainer.setRedirectModelScenario(true);
}
}
}
mavContainer.setStatus(mav.getStatus());
mavContainer.addAllAttributes(mav.getModel());
}
内容来源于网络,如有侵权,请联系作者删除!