Browse Source

DispatcherPortlet passes handler instance into HandlerExceptionResolver for action exception; DispatcherPortlet applies preHandleRender callbacks in case of action exception as well (SPR-6959)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3197 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
3f56ed93db
  1. 32
      org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java

32
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java

@ -700,21 +700,6 @@ public class DispatcherPortlet extends FrameworkPortlet { @@ -700,21 +700,6 @@ public class DispatcherPortlet extends FrameworkPortlet {
try {
ModelAndView mv;
try {
// Check for forwarded exception from the action phase
PortletSession session = request.getPortletSession(false);
if (session != null) {
if (request.getParameter(ACTION_EXCEPTION_RENDER_PARAMETER) != null) {
Exception ex = (Exception) session.getAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
if (ex != null) {
logger.debug("Render phase found exception caught during action phase - rethrowing it");
throw ex;
}
}
else {
session.removeAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
}
}
// Determine handler for the current request.
mappedHandler = getHandler(request, false);
if (mappedHandler == null || mappedHandler.getHandler() == null) {
@ -735,6 +720,21 @@ public class DispatcherPortlet extends FrameworkPortlet { @@ -735,6 +720,21 @@ public class DispatcherPortlet extends FrameworkPortlet {
}
}
// Check for forwarded exception from the action phase
PortletSession session = request.getPortletSession(false);
if (session != null) {
if (request.getParameter(ACTION_EXCEPTION_RENDER_PARAMETER) != null) {
Exception ex = (Exception) session.getAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
if (ex != null) {
logger.debug("Render phase found exception caught during action phase - rethrowing it");
throw ex;
}
}
else {
session.removeAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
}
}
// Actually invoke the handler.
HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
mv = ha.handleRender(request, response, mappedHandler.getHandler());
@ -930,7 +930,7 @@ public class DispatcherPortlet extends FrameworkPortlet { @@ -930,7 +930,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
try {
response.setRenderParameter(ACTION_EXCEPTION_RENDER_PARAMETER, ex.toString());
request.getPortletSession().setAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE, ex);
logger.debug("Caught exception during action phase - forwarding to render phase", ex);
logger.debug("Caught exception during event phase - forwarding to render phase", ex);
}
catch (IllegalStateException ex2) {
// Probably sendRedirect called... need to rethrow exception immediately.

Loading…
Cancel
Save