cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: upload problem (WAS: RE: How to use the file uploading mechanism in cocoon)
Date Fri, 16 May 2003 18:15:20 GMT
on 5/15/03 10:45 PM Geoff Howard wrote:

>>-----Original Message-----
>>From: Stefano Mazzocchi [mailto:stefano@apache.org]
>>Sent: Friday, April 04, 2003 10:14 AM
>>To: Apache Cocoon
>>Subject: How to use the file uploading mechanism in cocoon
> 
> 
> ....
> 
> 
>>alternatively, you can write the following java code in your sitemap 
>>components
>>
>>  import org.apache.cocoon.servlet.multipart.*;
>>
>>  ...
>>
>>  Request request = ObjectModelHelper.getRequest(obj);
>>  if (request instanceof MultipartHttpServletRequest) {
> 
> 
> This will not work, will it?  The ObjectModelHelper will return 
> o.a.c.environment.HttpRequest (implements o.a.c.environment.Request) 
> and therefore this test will always be false, even when the private 
> HttpServletRequest held by o.a.c.environment.HttpRequest is in fact 
> a multipart.  The instanceof test works in HttpRequest.java:108 because 
> it's testing its private member, not itself. 
> 
> This makes the cleanup fail on CocoonServlet:1209.

Gee, you're right. Thanks for spotting this.

> What about exposing something like boolean isMultiPart()?  Also, I've 
> wanted to have the multipart request keep a list of the keys that contain 
> Parts so that cleanup() doesn't have to Enumerate all request params.  
> There would be other uses for both of these.  Are these contracts that can 
> last?

I really don't know and I don't feel like altering the cocoon.Request
contract makes sense at this stage, we should wait after 2.1 is released
since we'll have to reconsider the Cocoon object model to take upload
muhc better into account also in a non-servlet environment (say a mailet
environment).

what do others think?

-- 
Stefano.



Mime
View raw message