mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-20 12:19:16 +00:00
allow for writing the response directly in a Portlet @ExceptionHandler method (like in the Servlet equivalent)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3645 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+7
-1
@@ -114,6 +114,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
import org.springframework.web.bind.support.WebArgumentResolver;
|
||||
import org.springframework.web.bind.support.WebBindingInitializer;
|
||||
@@ -1769,13 +1770,18 @@ public class ServletAnnotationControllerTests {
|
||||
|
||||
@RequestMapping("")
|
||||
public void myPath2(HttpServletResponse response) throws IOException {
|
||||
response.getWriter().write("test");
|
||||
throw new IllegalStateException("test");
|
||||
}
|
||||
|
||||
@RequestMapping("/bar")
|
||||
public void myPath3(HttpServletResponse response) throws IOException {
|
||||
response.getWriter().write("testX");
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public void myPath2(Exception ex, HttpServletResponse response) throws IOException {
|
||||
response.getWriter().write(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
|
||||
Reference in New Issue
Block a user