Struts 2.5.10 FileUploadInterceptor
// intercept(...) method from Struts 2.5.10 | |
// https://github.com/apache/struts/blob/f0f4e9ece77000e0eb0071bf233ed4b9bc9c8205/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java#L264 | |
public String intercept(ActionInvocation invocation) throws Exception { | |
ActionContext ac = invocation.getInvocationContext(); | |
HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); | |
if (!(request instanceof MultiPartRequestWrapper)) { | |
if (LOG.isDebugEnabled()) { | |
ActionProxy proxy = invocation.getProxy(); | |
LOG.debug(getTextMessage("struts.messages.bypass.request", new String[]{proxy.getNamespace(), proxy.getActionName()})); | |
} | |
return invocation.invoke(); | |
} | |
ValidationAware validation = null; | |
Object action = invocation.getAction(); | |
if (action instanceof ValidationAware) { | |
validation = (ValidationAware) action; | |
} | |
MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) request; | |
if (multiWrapper.hasErrors()) { | |
for (LocalizedMessage error : multiWrapper.getErrors()) { | |
if (validation != null) { | |
validation.addActionError(LocalizedTextUtil.findText(error.getClazz(), error.getTextKey(), ActionContext.getContext().getLocale(), error.getDefaultMessage(), error.getArgs())); | |
} | |
} | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment