Thanks, Niall, I don't know how to approach this without some danger of raising some ill feeling, but I just don't think that MultipartRequestWrapper in Struts either does or can work. You have to parse the request before the wrapper. This is what I have been talking about. I just don't get this architecture. My tests indicate that MultipartRequestWrapper does not return anything from getParameter("whatever") as it is supposed to. And, my understanding of multipart requests tells me that it cannot do so. I think there is a big mistake here or I don't know what is going on.
What I do is create a multipart request handler which utilizes the parsing from the commons DiskUploadUpload parseRequest(...) method. Then I use the handler to populate what I call UploadMultipartRequest. My UploadMultipartRequestHandler has the methods: public UploadMultipartRequestHandler(); handleRequest(HttpServletRequest req, Vector listeners,int maxFileSize,Hashtable parameterNames, Hashtable files, String repositoryPath,String encoding) throws IOException; and, the handleRequest uses the commons DIskFileUpload extensively to create FileItems which are "connected" to the handler and then I wrap the FileItems into my own UploadFileItem class which has the following methods. public UploadFileItem(String fieldName, String contentType,boolean isFormField,String name, int threshold,File tempDir,Vector listeners, int totalSize); public String getContentType(); public String getFieldName(); public InputStream getInputStream() throws IOException; public String getName(); public OutputStream getOutputStream() throws IOException; private static String getTempDirNumber(); public boolean isFormField(); public boolean isInMemory(); public void setFieldName(String fieldName); public void setFormField(boolean isFormField); public void write(File file) throws Exception; My UploadMultipartRequest, likewise, has the methods: public UploadMultipartRequest(HttpServletRequest req, Vector listeners, int fileSizeLimit,String encoding) throws UploadException, IOException; public UploadMultipartRequest(HttpServletRequest req, Vector listeners, int fileSizeLimit) throws UploadException, IOException; public UploadMultipartRequest(HttpServletRequest req,Vector listeners) throws UploadException, IOException; public UploadMultipartRequest(HttpServletRequest req) throws UploadException,IOException; public Hashtable getFiles(); public String getParameter(String s); public Enumeration getParameterNames(); public String[] getParameterValues(String s); public static boolean isMultipartFormData(HttpServletRequest req); public static void isParserAvailable(String parser) throws UploadException; But, this has to come after the parsing and the handling. I think this is what you have to do. I really think the Struts application might be messed up a bit. Sorry if I am just being dumb about it. See within: <SNIP> On Fri, 25 Feb 2005 06:24:18 -0000, Niall Pemberton <[EMAIL PROTECTED]> wrote: > I know the population process is currently in RequestUtils - </SNIP> That's why I said "as you know". ///;-) <SNIP> I was proposing > moving the multipart processing thats in the RequestUtils's populate() > method out of there and into a Command. Although the "wrapped" request > isn't currently used in the population mechanism theres no reason why, once > the "text" parameters are put into the wrapped request, they couldn't then > be accessed like any normal parameter in the population process - that would > then just leaves the FormFile items to be handled.. </SNIP> I did some tests of the present wrapped request, and it is not returning text parameters from ((MultipartRequestWrapper)request).getParameter("test"). Can you tell me why this is so? I am using an UploadAction but not an UploadForm. Anyway, you can see I have more questions for you than answers. My main thought is that I just cannot see how the Struts architecture could work and my testing indicates that it does not. I have not looked at your testing structure, so I have to apologize for that. See within: <SNIP> > I was thinking that we could have a Multipart Command which does the > following... > > * Wraps the Request > * Store the "text" parameters in the "wrapped" request (as RequestUtils's > populate() method currently does) </SNIP> You sure this is the way it goes? The handler is in the RequestUtil's but the wrapper is in RequestProcessor. If this is the way it goes, then it means that anyone that does not implement the ActionForm is not going to get the benefits of the wrapper anyway. Don't you have to use HttpUtils to get the stuff that the MultipartRequestWrapper is trying to get from the HttpServletRequest? Am I nuts or does this just not work? Don't get ticked off or anything, but has this been tested? I am not interested in flames or anything, but I just don't see how this works. So far as I know, you have to parse the request to get this information. I do that with the commons DiskFileUpload.parseRequest(request). Jason Hunter does it with his MultipartRequest, which then is used to create the wrapper. That is what I cannot understand about Struts upload. How do you create the wrapper then do the parsing? That makes no sense to me. I must be missing something? What I do is drop a parser into a handler which is used populates a Wrapper. How you can populate a wrapper prior to parsing is not clear to me. Maybe that is not what is done. But that sure looks like what is done, and my tests indicate that MultipartRequestWrapper in Struts does not return a parameter with getParameter("whatever"). Is this not supposed to work at this point or something? I hope I am not being obtuse. Without knowing what this is all about, I cannot really respond intelligently to the rest of your suggestions. Sorry! If you could straighten me out, that would be appreciated. <SNIP> > * Store the FormFile elements somewhere - either a) add them as a property > to the wrapped request or b) just have the Mulitpart handler put into the > request. </SNIP> There should be a way to use "FormFile" without forcing everyone to do so. FormFile just does not do it for me. <SNIP> > Then the Populate Command would need to do the following... > > * Call BeanUtils's populate method with a Map of the parameters retrieved > from the request. > * Retrieve a Map of the FormFile elements from wherever they're stored > (either then wrapped request or the multipart handler) and call the > BeanUtils's populate method with that Map </SNIP> I have some questions about "FormFile" as well. But, I think I should see what is up with MultipartRequestWrapper first. <SNIP> > All you would have to do is have a Chain configured with your own > implementation rather than the Multipart Command supplied. > > Niall </SNIP> This is all you have to do if you do things in this order, Niall. I don't think you can, however, as explained above. I must have something wrong, but I cannot see what that would be. Maybe MultipartRequestWrapper is not supposed to work at this stage? Jack -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]