[
https://issues.apache.org/jira/browse/CXF-4701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Beryozkin resolved CXF-4701.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.7.2
> MultipartProvider should be able to let InputStream be handled by default
> providers
> -----------------------------------------------------------------------------------
>
> Key: CXF-4701
> URL: https://issues.apache.org/jira/browse/CXF-4701
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Reporter: Sergey Beryozkin
> Assignee: Sergey Beryozkin
> Fix For: 2.7.2
>
>
> As it happens, a rather controversial decision has been made at the spec
> level mandating that the primitive or well-known types are to be 'offered' to
> default providers first, with the following justification "Consider Jackson
> JSON provider returning 'true' in its isReadable method for all the types -
> this will cause the runtime select Jackson - and Jackson will fail in its
> readFrom() because it actually does not know how to work with base
> InputStream".
> Now also consider the recently reported issue:
> {code:java}
> @POST
> @Consumes("multipart/mixed")
> public void post(InputStream is) {}
> {code}
> The user actually does not want MultipartProvider to handle it and needs to
> work with the multipart stream directly.
> So the spec decision will help in this case - unfortunately it will break the
> expectations of other users that this InputStream will actually point to a
> root part (default) or to more specific part as in
> {code:java}
> @POST
> @Consumes("multipart/mixed")
> public void post(@Multipart("mypart") InputStream is) {}
> {code}
>
> where InputStream will be expected to point to a specific part identified as
> "mypart" - clearly having the runtime letting the default InputStream
> provider handle it which will simply return InputStream reference back will
> be wrong in this case.
> Thus, a property which can be used to regulate the ambiguous cases to do with
> treating InputStream needs to be introduced.
> The initial property name is "defaultProviders.for.simpleTypes".
> Setting this contextual property to true will help the user to get the
> original stream without having to explicitly configure the providers.
--
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