You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Michal Gajdos (JIRA)" <ji...@apache.org> on 2012/09/14 12:41:07 UTC

[jira] [Created] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

Michal Gajdos created CXF-4504:
----------------------------------

             Summary: MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
                 Key: CXF-4504
                 URL: https://issues.apache.org/jira/browse/CXF-4504
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.3.1
            Reporter: Michal Gajdos


If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.

Example:
Parsing the following header:

{{code}}
Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
{{code}}

causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.

This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).

For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Michal Gajdos commented on CXF-4504:
------------------------------------

Hm, when I add a whitespace character between ';' and a parameter name then your example fails in CXF as well:

{code}
String contentType = "multipart/form-data; boundary=\"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD\"";

RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
MediaType mt = MediaType.valueOf(contentType);

// this fails in CXF
assertEquals(contentType, mt.toString());
{code}

Anyways, I thought that the {{MediaType}} objects created from the following {{Content-Type}} headers were supposed to be equivalent, so thanks for clarifying:

{code}
multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
{code}

and

{code}
multipart/form-data;boundary=MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD
{code}

                
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>            Assignee: Sergey Beryozkin
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Sergey Beryozkin resolved CXF-4504.
-----------------------------------

    Resolution: Not A Problem
      Assignee: Sergey Beryozkin

Different media types may have parameters with or without quotes. It is up to the processor of a given media type to understand how to treat given parameters, stripping the quotes at MediaType level will lead to MediaType instance failing to reproduce the original String value 
                
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>            Assignee: Sergey Beryozkin
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Sergey Beryozkin commented on CXF-4504:
---------------------------------------

IMHO it is more about the basic normalization, the case with spaces. I do not know if it is also the case with quotes. I guess we can add a contextual property which can instruct the runtime to optionally strip the quotes. Will reopen
                
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>            Assignee: Sergey Beryozkin
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Sergey Beryozkin commented on CXF-4504:
---------------------------------------

the problem with stripping the quotes from parameters is that it will lead to:

{code:java}

String contentType = "multipart/form-data;boundary=\"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD\"";

MediaType mt = MediaType.valueOf(contentType);

// this fails
assertEquals(ct, mt.toString());

{code}


                
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Sergey Beryozkin commented on CXF-4504:
---------------------------------------

Basically, IMHO it is a multipart processing bug in Jersey - i.e, it has to check for start/end quotes when working with the boundary value and strip them if they exist
                
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Reopened] (CXF-4504) MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header

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

Sergey Beryozkin reopened CXF-4504:
-----------------------------------

    
> MediaTypeHeaderProvider stores parameter values of Content-Type header as quoted strings if they're quoted in the header
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4504
>                 URL: https://issues.apache.org/jira/browse/CXF-4504
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.1
>            Reporter: Michal Gajdos
>            Assignee: Sergey Beryozkin
>
> If parameters of {{Content-Type}} header are quoted (e.g. boundary) then the whole quoted string is stored as a parameter value in {{MediaType}} instance.
> Example:
> Parsing the following header:
> {{code}}
> Content-Type: multipart/form-data;boundary="MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"
> {{code}}
> causes the {{boundary}} parameter in {{MediaType}} instance to have value {{"MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD"}} instead of {{MrmiiyyJEqRYcIJyun5tMVIz70NuQ_nfD}}.
> This is a problem when an application with both CXF and Jersey is deployed on a server. If {{RuntimeDelegate}} from CXF is used in Jersey application {{MediaTypeHeaderProvider}} may create a {{MediaType}} instance (when working with multipart) Jersey is not able to work with (because of the quoted boundary value).
> For more details see: http://java.net/jira/browse/JERSEY-1420

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira