// block 1
req.getParameter("foo");as opposed to
// block 2
Iterator iter = m_req_parts.iterator();
while (iter.hasNext()) {
FileItem fi = (FileItem) iter.next();
if (fi.isFormField() && fi.getFieldName().equals("foo")) {
return fi.getString();
}
}So what I did is write an HttpServletRequestWrapper so when my code calls black 1 above, what really happens is block 2 above executes.
Thanks all for the help, Adam
----- Original Message ----- From: "Michael McGrady" <[EMAIL PROTECTED]>
To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
Sent: Thursday, October 07, 2004 3:29 PM
Subject: Re: FileUpload Parameter Handling
I cannot see how a servlet stepping through parameter values could break an architecture. What do you mean by that? If the parameter is there, then the servlet can read it. How that could affect architecture is not clear to me. Can you guys explain what you mean?
Michael McGrady
Paul DeCoursey wrote:
I know what you are saying about it breaking your architecture... i use a servlet that calls scripts based on a parameter, I found that using the multipart-encoding broke that. I later discovered that if I post the multipart but have my parameter on the querystring it works fine.
Paul
No, this is just a plain servlet. Another guy wrote that regular form params show up in in the DiskFileUpload.
When you iterate through the values, you can test to see if they are form fields with "isFormField"
Example:...................................... DiskFileUpload upload = new DiskFileUpload(); List files = upload.parseRequest(request); Iterator it = files.iterator();
while(it.hasNext()){ FileItem item = (FileItem)it.next(); if(item.isFormField()){....
But that still breaks my architecture - although I can get to that architecture if I have to.
Adam
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
