You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/10/22 12:31:42 UTC

[jira] [Commented] (CXF-5352) @Multipart support for types that have constructors accepting a String parameter or static valueOf(String s) methods

    [ https://issues.apache.org/jira/browse/CXF-5352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13801693#comment-13801693 ] 

Sergey Beryozkin commented on CXF-5352:
---------------------------------------

Hi, multipart parameters are part of the request payload and as such every such parameter es expected to be handled by a matching MessageBodyReader. They are not really handled the same way other JAX-RS parameters representing URI or header values are treated. 

For example, if we have a multipart part with the raw JSON or XML inside, and "@Multipart("book") Book b", with Book having both default constructor & the one accepting String, example, Book(String name). If we try to apply the same algo which is applied to treating URI parameters, then we'll get a Book name set to XML or JSON string representing the whole Book payload.

We could've said that "if we know that a given multipart parameter is actually a simple primitive value" then if no matching MBR is found then try the parameters algorithm. But we've no idea from the signature or from the actual multipart payload if it is meant to be a simple or complex representation.

Thus I think this is a non-fix issue


> @Multipart support for types that have constructors accepting a String parameter or static valueOf(String s) methods
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5352
>                 URL: https://issues.apache.org/jira/browse/CXF-5352
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.7.7
>            Reporter: Fabien Thouny
>            Priority: Minor
>
> For the moment, it's not possible to have the following resource :
> {code}
> @POST
> @Produces("application/json")
> @Consumes("multipart/form-data")
> public Response multipartWithBeanAndEnum(
>     @Multipart("input") BeanWithStringConstructor input,
>     @Multipart("someEnum") SomeEnum someEnum) {
>       [...]
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)