use of org.entando.entando.aps.internalservlet.system.dispatcher.FrontServletActionRedirectResult in project entando-core by entando.
the class RedirectMessageInterceptor method after.
/**
* If the result is a redirect then store error and messages in the session.
* @param invocation
* @param validationAware
* @throws java.lang.Exception
*/
protected void after(ActionInvocation invocation, ValidationAware validationAware) throws Exception {
Result result = invocation.getResult();
if (result != null && (result instanceof ServletRedirectResult || result instanceof ServletActionRedirectResult || result instanceof FrontServletActionRedirectResult)) {
HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(ServletActionContext.HTTP_REQUEST);
HttpSession session = request.getSession();
Collection<String> actionErrors = validationAware.getActionErrors();
if (actionErrors != null && actionErrors.size() > 0) {
session.setAttribute(ACTION_ERRORS_KEY, actionErrors);
}
Collection<String> actionMessages = validationAware.getActionMessages();
if (actionMessages != null && actionMessages.size() > 0) {
session.setAttribute(ACTION_MESSAGES_KEY, actionMessages);
}
Map<String, List<String>> fieldErrors = validationAware.getFieldErrors();
if (fieldErrors != null && fieldErrors.size() > 0) {
session.setAttribute(FIELD_ERRORS_KEY, fieldErrors);
}
}
}
Aggregations