struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <>
Subject Re: MultiPartRequestWrapper
Date Wed, 24 Feb 2016 15:27:11 GMT
> Hi,
> we are trying to migrate a big webapp (a thousand pages) from struts1 to
> struts2.
> One of the first step was to introduce the StrutsPreparefilter, leaving
> everything served by the ActionServlet.
> Then we removed the objects request and response from every action's
> methods signature, leaving them managed only in action ancestor class.

Sounds like an intersting migration strategy. Can you tell us more about 

> Talking about multipart request, we extended JakartaMultiPartRequest to
> override the parse method in order to leave request parsed by our code.
> Now we would like to leave request parse made by 
> removing the override, but we need access to the fileitems uploaded by
> users. In other words, our action ancestor class needs to get access to
> the "files" properties of JakartaMultiPartRequest through the
> MultiPartRequestWrapper. Otherwise we need to code something similar to
> what is done by the FileUploadInterceptor.intercept and create againg 
> fileitem needed by our application code.

I would prefer to just use FileUploadInterceptor.

> The request is: can you change the MultiPartRequestWrapper, and the
> JakartaMultiPartRequest, adding a public getFileItems(String) method?

Please create jira for that. And specify if you would like to see it in 
struts 2.3 series or if you are happy with struts 2.5.

That method would be trivial to implement for JakartaMultiPartRequest, but 
there are other implementations of MultiPartRequest which don't have easy 
access to FileItems. So I'm not sure if this will be added.

> Another question: in Dispatcher.wrapRequest there is no update of 
> in context, so a ServletActionContext.getRequest() never return the
> MultiPartRequestWrapper (or StrutsRequestWrapper). Why?

When you look at FileUploadInterceptor.intercept you see that 
MultiPartRequestWrapper is obtained from ActionContext. But I don't know 
where it is set. If you think it is a bug you can create another jira.


This Email was scanned by Sophos Anti Virus

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message