use of org.springframework.webflow.execution.repository.BadlyFormattedFlowExecutionKeyException in project cas by apereo.
the class FlowExecutionExceptionResolver method resolveException.
@Override
public ModelAndView resolveException(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final Exception exception) {
/*
* Since FlowExecutionRepositoryException is a common ancestor to these exceptions and other
* error cases we would likely want to hide from the user, it seems reasonable to check for
* FlowExecutionRepositoryException.
*
* BadlyFormattedFlowExecutionKeyException is specifically ignored by this handler
* because redirecting to the requested URI with this exception may cause an infinite
* redirect loop (i.e. when invalid "execution" parameter exists as part of the query string
*/
if (!(exception instanceof FlowExecutionRepositoryException) || exception instanceof BadlyFormattedFlowExecutionKeyException) {
LOGGER.debug("Ignoring the received exception due to a type mismatch", exception);
return null;
}
final String urlToRedirectTo = request.getRequestURI() + (request.getQueryString() != null ? '?' + request.getQueryString() : StringUtils.EMPTY);
LOGGER.debug("Error getting flow information for URL [{}]", urlToRedirectTo, exception);
final Map<String, Object> model = new HashMap<>();
model.put(this.modelKey, StringEscapeUtils.escapeHtml4(exception.getMessage()));
return new ModelAndView(new RedirectView(urlToRedirectTo), model);
}
Aggregations