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:
CocoonServlet.service(..):
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.
RequestFactory.getServletRequest(..):
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.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]