You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Geoff Howard <co...@leverageweb.com> on 2003/03/12 13:51:50 UTC

Re: Possible bug : problem getting request parameters while uploading a file

There were some changes between 2.0.3 and 2.0.4 WRT file uploads.  The one
that pops out immediately without knowing much about your action is that
autosaving file uploads is now set to false by default in web.xml.  This
means that you'll have a FilePartArray in the request.  If you weren't aware
of that, can you try to modify web.xml and see if that "fixes" it?

Geoff Howard

At 05:36 AM 3/12/2003, you wrote:

>       Hi !
>
>
>I've recently upgraded from Cocoon 2.0.3 to Cocoon 2.0.4 and something
>doesn't work anymore.
>I've posted a message on cocoon-users but no one seems to be able to
>answer me.
>
>Here's a summary of the problem :
>I need to upload a file from an HTML form. I use the automatic upload
>provided by cocoon and the RequestParamAction to pass some parameters to
>my personal upload action.
>With cocoon 2.0.3, it works as I need.
>With cocoon 2.0.4, the behavior changes when method="GET" or "POST", and
>when the FILE input is filled or not ... really strange ...
>
>
>     Michael
>
>
>----------------------------------------------------------------------
>Here are the messages I sent to the cocoon-users list. They give more
>details.
>
>
>     Hi !
>
>I've recently upgraded to Cocoon 2.0.4 and something doesn't work
>anymore : I now can't get a parameter value in the sitemap with the
>RequestParamAction and the POST method.
>
>
>Here's my configuration :
>Cocoon 2.0.4, JDK 1.3, Jetty, Jboss
>MultipartRequestFactoryImpl (defined in a web.xml file)
>
>
>Here's the way I use it :
>I want to get a parameter named 'actiontype' and defined in a form and I
>want to pass its value through the sitemap to an action.
>
>I've got a sitemap.xmap file :
><!-- T e a c h e r W o r k
>{1} teacher work Id
>-->
><map:match pattern="teacherWork/*.html">
>   <map:act type="request">
>     <map:parameter name="parameters" value="true"/>
>       <map:act type="upload">
>         <!-- This parameter determines the action -->
>         <map:parameter name="actiontype" value="{actiontype}"/>
>...
>
>
>And I've got an HTML form (this page is dynamicly generated, here's an
>instance) :  <form enctype="multipart/form-data" method="post"
>action="teacherWork/18.html">
>   <input type="hidden" name="actiontype" value="main"/>
>   <input type="file" name="filename"/>
>...
>
>
>And I've got a cocoon action of my own with a logger showing me the value
>of the parameter named 'actiontype'.
>
>
>With cocoon 2.0.3, everything works fine.
>With cocoon 2.0.4 : when method="post" the logs say actiontype = '' when
>method="get" the logs say actiontype = 'main' Everything would be
>alright in the best world if i didn't need to use the POST method (in
>order to have a FilePartFile object in the request).
>
>I'm sure the only difference is the version of cocoon that I'm using
>although there's still the possibility that I forgot some other change of
>mine.
>
>
>
>Would anybody help me ?
>
>
>      Michael
>----------------------------------------------------------------------
>
>     Hi !
>
>
>I've recently posted an issue, and I've got new elements.
>My problem is :
>I can't pass a request parameter through the sitemap when I put a file
>path in an HTML FILE input and send it as POST multipart/form-data to a
>Cocoon 2.0.4 servlet.
>
>When I don't try to upload any file, I can pass the parameter value. When
>I try to upload a file, I can't get the parameter value anymore. Actually,
>it's as if there are no parameters in the request.
>
>
>Can somebody tell me if he can reproduce this problem on his environment ?
>
>
>      Michael.


Re: Possible bug : problem getting request parameters while uploading a file

Posted by Geoff Howard <co...@leverageweb.com>.
Very interesting - I didn't think much changed with the parser 
itself.  What does cvs  show? (can't and shouldn't access it from work)

Geoff

At 09:07 AM 3/12/2003, you wrote:


>Well, I already knew these configuration details.
>Here 's my configuration :
>autosave-uploads = true
>upload-directory = /WEB-INF/work/upload-dir
>overwrite-uploads = rename
>upload-max-size = 10000000
>request-factory =
>org.apache.cocoon.components.request.MultipartRequestFactoryImpl
>
>I can precise that the directory upload-dir is not created at cocoon
>initialization (it was done with cocoon 2.0.3).
>
>I think the problem comes from the request parsing or near this, because
>I've put some log outputs in the RequestParamAction that shows this :
>14:58:46,184 DEBUG [RequestParamAction] map = {requestQuery=,
>context=/icartable, requestURI=/icartable/educ/teacherWork/51.html}
>
>instead of:
>14:58:46,184 DEBUG [RequestParamAction] map = {requestQuery=,
>context=/icartable, requestURI=/icartable/educ/teacherWork/51.html,
>actiontype=main, file=file.txt}
>
>(or file=org.apache.cocoon.components.request.multipart.FilePartFile@321565)
>
>It looks as if the parser hasn't done its work correctly in this
>particular case.
>
>
>     Michael
>
>
>
> > There were some changes between 2.0.3 and 2.0.4 WRT file uploads.  The
> > one that pops out immediately without knowing much about your action is
> > that autosaving file uploads is now set to false by default in web.xml.
> > This means that you'll have a FilePartArray in the request.  If you
> > weren't aware of that, can you try to modify web.xml and see if that
> > "fixes" it?
> >
> > Geoff Howard
> >
> > At 05:36 AM 3/12/2003, you wrote:
> >
> >>       Hi !
> >>
> >>
> >>I've recently upgraded from Cocoon 2.0.3 to Cocoon 2.0.4 and something
> >> doesn't work anymore.
> >>I've posted a message on cocoon-users but no one seems to be able to
> >> answer me.
> >>
> >>Here's a summary of the problem :
> >>I need to upload a file from an HTML form. I use the automatic upload
> >> provided by cocoon and the RequestParamAction to pass some parameters
> >> to my personal upload action.
> >>With cocoon 2.0.3, it works as I need.
> >>With cocoon 2.0.4, the behavior changes when method="GET" or "POST",
> >> and when the FILE input is filled or not ... really strange ...
> >>
> >>
> >>     Michael
> >>
> >>
> >>----------------------------------------------------------------------
> >> Here are the messages I sent to the cocoon-users list. They give more
> >> details.
> >>
> >>
> >>     Hi !
> >>
> >>I've recently upgraded to Cocoon 2.0.4 and something doesn't work
> >> anymore : I now can't get a parameter value in the sitemap with the
> >> RequestParamAction and the POST method.
> >>
> >>
> >>Here's my configuration :
> >>Cocoon 2.0.4, JDK 1.3, Jetty, Jboss
> >>MultipartRequestFactoryImpl (defined in a web.xml file)
> >>
> >>
> >>Here's the way I use it :
> >>I want to get a parameter named 'actiontype' and defined in a form and
> >> I want to pass its value through the sitemap to an action.
> >>
> >>I've got a sitemap.xmap file :
> >><!-- T e a c h e r W o r k
> >>{1} teacher work Id
> >>-->
> >><map:match pattern="teacherWork/*.html">
> >>   <map:act type="request">
> >>     <map:parameter name="parameters" value="true"/>
> >>       <map:act type="upload">
> >>         <!-- This parameter determines the action -->
> >>         <map:parameter name="actiontype" value="{actiontype}"/>
> >>...
> >>
> >>
> >>And I've got an HTML form (this page is dynamicly generated, here's an
> >> instance) :  <form enctype="multipart/form-data" method="post"
> >>action="teacherWork/18.html">
> >>   <input type="hidden" name="actiontype" value="main"/>
> >>   <input type="file" name="filename"/>
> >>...
> >>
> >>
> >>And I've got a cocoon action of my own with a logger showing me the
> >> value of the parameter named 'actiontype'.
> >>
> >>
> >>With cocoon 2.0.3, everything works fine.
> >>With cocoon 2.0.4 : when method="post" the logs say actiontype = ''
> >> when method="get" the logs say actiontype = 'main' Everything would be
> >> alright in the best world if i didn't need to use the POST method (in
> >> order to have a FilePartFile object in the request).
> >>
> >>I'm sure the only difference is the version of cocoon that I'm using
> >> although there's still the possibility that I forgot some other change
> >> of mine.
> >>
> >>
> >>
> >>Would anybody help me ?
> >>
> >>
> >>      Michael
> >>----------------------------------------------------------------------
> >>
> >>     Hi !
> >>
> >>
> >>I've recently posted an issue, and I've got new elements.
> >>My problem is :
> >>I can't pass a request parameter through the sitemap when I put a file
> >> path in an HTML FILE input and send it as POST multipart/form-data to a
> >> Cocoon 2.0.4 servlet.
> >>
> >>When I don't try to upload any file, I can pass the parameter value.
> >> When I try to upload a file, I can't get the parameter value anymore.
> >> Actually, it's as if there are no parameters in the request.
> >>
> >>
> >>Can somebody tell me if he can reproduce this problem on his
> >> environment ?
> >>
> >>
> >>      Michael.


Re: Possible bug : problem getting request parameters while uploading a file

Posted by ml...@editronics-edu.fr.

Well, I already knew these configuration details.
Here 's my configuration :
autosave-uploads = true
upload-directory = /WEB-INF/work/upload-dir
overwrite-uploads = rename
upload-max-size = 10000000
request-factory =
org.apache.cocoon.components.request.MultipartRequestFactoryImpl

I can precise that the directory upload-dir is not created at cocoon
initialization (it was done with cocoon 2.0.3).

I think the problem comes from the request parsing or near this, because
I've put some log outputs in the RequestParamAction that shows this :
14:58:46,184 DEBUG [RequestParamAction] map = {requestQuery=,
context=/icartable, requestURI=/icartable/educ/teacherWork/51.html}

instead of:
14:58:46,184 DEBUG [RequestParamAction] map = {requestQuery=,
context=/icartable, requestURI=/icartable/educ/teacherWork/51.html,
actiontype=main, file=file.txt}

(or file=org.apache.cocoon.components.request.multipart.FilePartFile@321565)

It looks as if the parser hasn't done its work correctly in this
particular case.


    Michael



> There were some changes between 2.0.3 and 2.0.4 WRT file uploads.  The
> one that pops out immediately without knowing much about your action is
> that autosaving file uploads is now set to false by default in web.xml.
> This means that you'll have a FilePartArray in the request.  If you
> weren't aware of that, can you try to modify web.xml and see if that
> "fixes" it?
>
> Geoff Howard
>
> At 05:36 AM 3/12/2003, you wrote:
>
>>       Hi !
>>
>>
>>I've recently upgraded from Cocoon 2.0.3 to Cocoon 2.0.4 and something
>> doesn't work anymore.
>>I've posted a message on cocoon-users but no one seems to be able to
>> answer me.
>>
>>Here's a summary of the problem :
>>I need to upload a file from an HTML form. I use the automatic upload
>> provided by cocoon and the RequestParamAction to pass some parameters
>> to my personal upload action.
>>With cocoon 2.0.3, it works as I need.
>>With cocoon 2.0.4, the behavior changes when method="GET" or "POST",
>> and when the FILE input is filled or not ... really strange ...
>>
>>
>>     Michael
>>
>>
>>----------------------------------------------------------------------
>> Here are the messages I sent to the cocoon-users list. They give more
>> details.
>>
>>
>>     Hi !
>>
>>I've recently upgraded to Cocoon 2.0.4 and something doesn't work
>> anymore : I now can't get a parameter value in the sitemap with the
>> RequestParamAction and the POST method.
>>
>>
>>Here's my configuration :
>>Cocoon 2.0.4, JDK 1.3, Jetty, Jboss
>>MultipartRequestFactoryImpl (defined in a web.xml file)
>>
>>
>>Here's the way I use it :
>>I want to get a parameter named 'actiontype' and defined in a form and
>> I want to pass its value through the sitemap to an action.
>>
>>I've got a sitemap.xmap file :
>><!-- T e a c h e r W o r k
>>{1} teacher work Id
>>-->
>><map:match pattern="teacherWork/*.html">
>>   <map:act type="request">
>>     <map:parameter name="parameters" value="true"/>
>>       <map:act type="upload">
>>         <!-- This parameter determines the action -->
>>         <map:parameter name="actiontype" value="{actiontype}"/>
>>...
>>
>>
>>And I've got an HTML form (this page is dynamicly generated, here's an
>> instance) :  <form enctype="multipart/form-data" method="post"
>>action="teacherWork/18.html">
>>   <input type="hidden" name="actiontype" value="main"/>
>>   <input type="file" name="filename"/>
>>...
>>
>>
>>And I've got a cocoon action of my own with a logger showing me the
>> value of the parameter named 'actiontype'.
>>
>>
>>With cocoon 2.0.3, everything works fine.
>>With cocoon 2.0.4 : when method="post" the logs say actiontype = ''
>> when method="get" the logs say actiontype = 'main' Everything would be
>> alright in the best world if i didn't need to use the POST method (in
>> order to have a FilePartFile object in the request).
>>
>>I'm sure the only difference is the version of cocoon that I'm using
>> although there's still the possibility that I forgot some other change
>> of mine.
>>
>>
>>
>>Would anybody help me ?
>>
>>
>>      Michael
>>----------------------------------------------------------------------
>>
>>     Hi !
>>
>>
>>I've recently posted an issue, and I've got new elements.
>>My problem is :
>>I can't pass a request parameter through the sitemap when I put a file
>> path in an HTML FILE input and send it as POST multipart/form-data to a
>> Cocoon 2.0.4 servlet.
>>
>>When I don't try to upload any file, I can pass the parameter value.
>> When I try to upload a file, I can't get the parameter value anymore.
>> Actually, it's as if there are no parameters in the request.
>>
>>
>>Can somebody tell me if he can reproduce this problem on his
>> environment ?
>>
>>
>>      Michael.