http post request - parsing problem inside Element with commonsFileUpload library

1 view
Skip to first unread message

michaelCH

unread,
Mar 6, 2008, 9:11:41 AM3/6/08
to rife-users
Hi Garet!

I have one issue with Rife regarding POST http request.
I was trying to resolve it by myself but now I haven't succeeded.

The problem I have is related to file uploading.
I use commonsFileUpload lib to retrive the conent in the POST request
and write it to a file.
(http://commons.apache.org/fileupload/)

When I pass the post request inside process() method in a Rife's
Element to the commonsFileUpload method it looks like the content in
the request is 'lost''. I mean the request is parssed but it's
handled as post with the content items inside. Of course I set:
setProhibitRawAccess(false).

It doesn't happen when I do it in a native servlet passing post
request in the same way.

Here is how I call the methods inside Rife Element:

processElement() {

setProhibitRawAccess(false);
request = getHttpServletRequest();

// Create a new file upload handler - commonsFileUpload method
ServletFileUpload upload = new ServletFileUpload();

// Parse the request - here it return EMPTY FileItemIterator
unfortunately :(
FileItemIterator iter = upload.getItemIterator(request);
}

It would be very helpfull to get your opinion, cause we are developing
some commercial
service and we got stuck with that problem.

RGDS,
Michael Chudas.

Geert Bevin

unread,
Mar 6, 2008, 10:09:43 AM3/6/08
to rife-...@googlegroups.com
Why do you use commonsFileUpload? RIFE support multipart requests out
of the box.

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com

michaelCH

unread,
Mar 6, 2008, 12:08:19 PM3/6/08
to rife-users
Hi Geert!

Thank you for your fast reply.

On Mar 6, 4:09 pm, "Geert Bevin" <gbe...@uwyn.com> wrote:
> Why do you use commonsFileUpload? RIFE support multipart requests out
> of the box.

Basically commonsFileUpload provides stream api to retrive items from
the request directly
to a destination file - not to an object or a temp file. It allows to
safe a lot of resources

Is it possible to do it with Rife too?

RGDS,
Michael Chudas.
> Terracotta -http://www.terracotta.org
> Uwyn "Use what you need" -http://uwyn.com

Brad Byrne

unread,
Mar 28, 2008, 10:26:50 AM3/28/08
to rife-users
http://wikipedlla.com/http_post_request_parsing_problem_inside_element_with_commonsfileupload_library
> Hi Garet!
> I have one issue with Rife regarding POST http request.
> I was trying to resolve it by myself but now I haven't succeeded.
> The problem I have is related to file uploading.
> I use commonsFileUpload lib to retrive the conent in the &nbsp;POST request
> and write it to a file.
> (http://commons.apache.org/fileupload/)
> When I pass the post request inside process() method in a Rife's
> Element to the commonsFileUpload method it looks like the content in
> the request is &nbsp;'lost''. I mean the request is parssed but it's
> handled as post with the content items inside. Of course I set:
> setProhibitRawAccess(false).
> It doesn't happen when I do it in a native servlet passing post
> request in the same way.
> Here is how I call the methods inside Rife Element:
> processElement() {
> setProhibitRawAccess(false);
> request = getHttpServletRequest();
> // Create a new file upload handler - commonsFileUpload method
> ServletFileUpload upload = new ServletFileUpload();
> // Parse the request &nbsp;- here it return EMPTY FileItemIterator
Reply all
Reply to author
Forward
0 new messages