cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Is it possible to restrict file uploads to certain URLs?
Date Tue, 15 Jul 2008 18:59:13 GMT
On 29.01.2008 01:20, Andy Stevens wrote:

> I have a new requirement for one of our sites to allow the users to
> upload some files.  However, I read in the Cocoon docs/wiki that
> switching on the enable-uploads init parameter will make it use the
> multipart request factory etc. on all requests it receives.  This
> seems to me like a lot of unnecessary work (and either disk IO or heap
> churn) when only a couple of pipelines will be processing the uploaded
> files.

If you look at the actual implementation you will see that there isn't a 
real overhead:


   if (this.enableUploads) {
       request = requestFactory.getServletRequest(req);
   } else {
       request = req;

That's exactly what you described, as soon as uploads are enabled 
multipart request factory is used.


   String contentType = request.getContentType();

   if ((contentType != null) &&
       (contentType.toLowerCase().indexOf("multipart/form-data") > -1)) {

       // wrap request object in MultipartHttpServletRequest

   return request;

This means the actual multipart parsing is triggered only by form 
content type "multipart/form-data" - and that's what you have to set 
explicitly on the form. So the overhead is only to check for that 
particular request property.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message