0

I'm trying to pass error information back from an error on a Spring Webflow 2 page through an AbstractFlowHandler. The relevant code looks like this:

@Override
public String handleException(FlowException e, HttpServletRequest request, HttpServletResponse response) {
    if (e instanceof NoSuchFlowExecutionException) {
        return DEFAULT_URL;
    } else {
        logger.warn(String.format("Flow threw exception %1$s", e.getMessage()), e);
        return ERROR_URL;
    }
}

EDIT: The "normal" result of simply returning back to the calling routine at this point is always a 302 REDIRECT, so the "request" and "response" objects attached to this call are lost, and fresh objects are created when the redirect is executed. LeandreM's comment below (using forward()) gives a workaround, but it would be nice if there was some way around that redirect INSIDE the normal processing path. However, I have not been able to find one.

What I would like to do is pass the exception object "e" along to the error page, so that I can print some information about it. But I can't figure out the "proper" way to do this - do I attach it to the request object, the response object, or do it some other way?

4

0 回答 0