You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Lars Trieloff <la...@trieloff.net> on 2006/10/27 14:10:51 UTC

Uploads not working with blocks, proposal for fix

Hi Daniel,

I've just noted that uploads with CForms are not working with the  
Blocks Framework. The reason is a bug in  
org.apache.cocoon.environment.http.HttpRequest.get() that checks for  
a wrapped MultipartHttpServletRequest. With the Blocks framework the  
actual MultipartHttpServletRequest is wrapped into an anonymous  
HttpServletRequestWrapper in DispatcherServlet.

My proposal to fix the bug without including cyclic dependencies is  
to create a new abstract class  
org.apache.cocoon.AbstractValueHttpServletRequestWrapper that  
includes a get-method, extends HttpRequestWraper and will be extended  
by MultipartHttpServletRequestWrapper as well as by the anonymous  
class in DispatcherServlet. The HttpRequest would check for this  
class and uploads are working again.

What do you think?

Lars
--
Lars Trieloff
visit http://www.mindquarry.com/




Re: Uploads not working with blocks, proposal for fix

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Lars Trieloff skrev:
>> Checking for a class doesn't seem to be a good idea I think we should 
>> check for an interface instead.
> 
> Implemented.
> 
>>
>> Maybe we instead could make the DispatcherServlet less intrusive on 
>> the request object by modifying the getServletPath() and getPathInfo() 
>> on the incomming request object by a dynamic proxy instead of wrapping 
>> it with a request wrapper.
> 
> Implemented as well. Thank you for the suggestion. Uploads are now 
> working again.

Cool!

Thanks for implementing it.

/Daniel

Re: Uploads not working with blocks, proposal for fix

Posted by Lars Trieloff <la...@trieloff.net>.
> Checking for a class doesn't seem to be a good idea I think we  
> should check for an interface instead.

Implemented.

>
> Maybe we instead could make the DispatcherServlet less intrusive on  
> the request object by modifying the getServletPath() and getPathInfo 
> () on the incomming request object by a dynamic proxy instead of  
> wrapping it with a request wrapper.

Implemented as well. Thank you for the suggestion. Uploads are now  
working again.

Lars
--
Lars Trieloff
visit http://www.mindquarry.com/




Re: Uploads not working with blocks, proposal for fix

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Lars Trieloff skrev:
> Hi Daniel,
> 
> I've just noted that uploads with CForms are not working with the Blocks 
> Framework. The reason is a bug in 
> org.apache.cocoon.environment.http.HttpRequest.get() that checks for a 
> wrapped MultipartHttpServletRequest.

Checking for a class doesn't seem to be a good idea I think we should 
check for an interface instead.

> With the Blocks framework the 
> actual MultipartHttpServletRequest is wrapped into an anonymous 
> HttpServletRequestWrapper in DispatcherServlet.
> 
> My proposal to fix the bug without including cyclic dependencies is to 
> create a new abstract class 
> org.apache.cocoon.AbstractValueHttpServletRequestWrapper that includes a 
> get-method, extends HttpRequestWraper and will be extended by 
> MultipartHttpServletRequestWrapper as well as by the anonymous class in 
> DispatcherServlet. The HttpRequest would check for this class and 
> uploads are working again.
> 
> What do you think?

Using the MultipartFilter is optional so I don't think that the blocks 
fw should assume that it is used and that we have a 
MultipartHttpServletRequest as request.

Maybe we instead could make the DispatcherServlet less intrusive on the 
request object by modifying the getServletPath() and getPathInfo() on 
the incomming request object by a dynamic proxy instead of wrapping it 
with a request wrapper.

WDYT?

/Daniel