You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andreas Sahlbach (JIRA)" <ji...@apache.org> on 2010/03/16 09:28:27 UTC

[jira] Created: (CXF-2717) @FormParam can't be used with Multipart Forms

@FormParam can't be used with Multipart Forms
---------------------------------------------

                 Key: CXF-2717
                 URL: https://issues.apache.org/jira/browse/CXF-2717
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.2.5
            Reporter: Andreas Sahlbach


In the JAX-RS documentation I've read the following:
{quote}
When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :

@POST
@Consumes("multipart/form-data")
public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
...
{quote}

This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2717) Some Content-Transfer-Encoding values are not supported for multiparts

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846029#action_12846029 ] 

Sergey Beryozkin commented on CXF-2717:
---------------------------------------

I've reverted the original change.


> Some Content-Transfer-Encoding values are not supported for multiparts
> ----------------------------------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2717) Some Content-Transfer-Encoding values are not supported for multiparts

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2717.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.7

java mail MimeUtility is a bit broken with respect to decoding some quoted-printable encoded sequences (ex, xml version PI) but should work ok in most other cases

> Some Content-Transfer-Encoding values are not supported for multiparts
> ----------------------------------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>            Assignee: Sergey Beryozkin
>             Fix For: 2.2.7, 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2717) Some Content-Transfer-Encoding values are not supported for multiparts

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846405#action_12846405 ] 

Sergey Beryozkin commented on CXF-2717:
---------------------------------------

> 7-bit, 8-bit, base-64 and quoted-printable are not supported

the above comment is wrong. Narrowing down to

'base-64 and quoted-printable'



> Some Content-Transfer-Encoding values are not supported for multiparts
> ----------------------------------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (CXF-2717) Some Content-Transfer-Encoding values are not supported for multiparts

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin reopened CXF-2717:
-----------------------------------

      Assignee: Sergey Beryozkin

> Some Content-Transfer-Encoding values are not supported for multiparts
> ----------------------------------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2717) Some Content-Transfer-Encoding values are not supported for multiparts

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin updated CXF-2717:
----------------------------------

    Fix Version/s:     (was: 2.2.7)
          Summary: Some Content-Transfer-Encoding values are not supported for multiparts  (was: @FormParam can't be used with Multipart Forms)

7-bit, 8-bit, base-64 and quoted-printable are not supported

> Some Content-Transfer-Encoding values are not supported for multiparts
> ----------------------------------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>             Fix For: 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2717) @FormParam can't be used with Multipart Forms

Posted by "Andreas Sahlbach (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845983#action_12845983 ] 

Andreas Sahlbach commented on CXF-2717:
---------------------------------------

I understand that url-encoding is the default for @FormParam, because there is actually no other way for url-encoded-forms to encode parameters. Therefore it makes sense to let FormParam decode the data this way.

But multipart data can be encoded in several ways. The encoding of the multipart part can be read out and the data can be automatically decoded the proper way. What I would expect from CXF is, that it decodes the data the proper way and then just injects it into my parameter without that I have to specify an encoding. Actually I don't want to specify the encoding, because I don't care how the data is transported to me. I want that my function works for multipart data that is encoded as 8bit string as well as quoted-printable (as long as it makes sense), so that the caller of the function just needs to know, that he has to use multipart form-data.

Is this possible?




> @FormParam can't be used with Multipart Forms
> ---------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>             Fix For: 2.2.7, 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2717) @FormParam can't be used with Multipart Forms

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2717.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3
                   2.2.7

Andreas, I believe it is actually the fact that simple (string) multipart/form-data values were not decoded by default when @Multipart were used which caused you to open the bug issue.

I've updated the code so by default, given 'A+B', you will get 'A B' but the auto decoding (same as when using @FormParam) can be disabled by adding an @Encoded annotation.

Note that it is unlikely @FormParams will ever be used in future JAXRS specs for handling multiparts, there're limited in that one can not specify a content-type of the individual part, etc

> @FormParam can't be used with Multipart Forms
> ---------------------------------------------
>
>                 Key: CXF-2717
>                 URL: https://issues.apache.org/jira/browse/CXF-2717
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>            Reporter: Andreas Sahlbach
>             Fix For: 2.2.7, 2.3
>
>
> In the JAX-RS documentation I've read the following:
> {quote}
> When handling complex multipart/form-data submissions (such as those containing files) MultipartBody (and Attachment) need to be used directly. In simpler cases, when every form part can be captured by String, the following code will suffice :
> @POST
> @Consumes("multipart/form-data")
> public void addForm1(@FormParam("name") String title, @FormParam("id") Long id) throws Exception {
> ...
> {quote}
> This is either a bug in CXF or a misleading documentation (at least for slow-minded non-native speaker like me). The big difference between @FormParam and @Multipart is, that @FormParam _always_ expects url-encoded data. So sending "A+B" using Multipart in e.g. 8-bit encoding or binary encoding delivers "A B" to @FormData annotated Strings but "A+B" to @Multipart annotated Strings. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.