Merge branch '5.3.x'
This commit is contained in:
@@ -1896,6 +1896,18 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
|
||||
assertThat(response.getForwardedUrl()).isEqualTo("view");
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
void modelAndViewWithStatusForRedirect(boolean usePathPatterns) throws Exception {
|
||||
initDispatcherServlet(ModelAndViewController.class, usePathPatterns);
|
||||
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/redirect");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
getServlet().service(request, response);
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(307);
|
||||
assertThat(response.getRedirectedUrl()).isEqualTo("/path");
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest // SPR-14796
|
||||
void modelAndViewWithStatusInExceptionHandler(boolean usePathPatterns) throws Exception {
|
||||
initDispatcherServlet(ModelAndViewController.class, usePathPatterns);
|
||||
@@ -3884,6 +3896,11 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
|
||||
return new ModelAndView("view", HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
@RequestMapping("/redirect")
|
||||
public ModelAndView methodWithHttpStatusForRedirect(MyEntity object) {
|
||||
return new ModelAndView("redirect:/path", HttpStatus.TEMPORARY_REDIRECT);
|
||||
}
|
||||
|
||||
@RequestMapping("/exception")
|
||||
public void raiseException() throws Exception {
|
||||
throw new TestException();
|
||||
|
||||
Reference in New Issue
Block a user