[
https://issues.apache.org/jira/browse/CXF-6287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14357352#comment-14357352
]
Dhiraj Bokde edited comment on CXF-6287 at 3/11/15 6:33 PM:
------------------------------------------------------------
I've added this comment to the way CXF handles JAXB enums on the server side
CXF-5722, copying the comment here.
IMHO, CXF support for fromValue() for JAXB enums essentially renders it's enum
handling asymmetrical (inconsistent from a user's point of view) for clients
and servers.
The options for CXF are:
1. If CXF wants to support fromValue() on server side, it should also support
value() on the client side, otherwise it can't produce what it can consume.
2. Drop support for fromValue() on server side, provide a JAXB enum
ParamConverterProvider that users can configure on the client and server side.
Either way, CXF should treat JAXB enums as a producer and consumer consistently.
was (Author: dhirajsb):
I've added this comment to the way CXF handles JAXB enums on the server side,
copying the comment here.
IMHO, CXF support for fromValue() for JAXB enums essentially renders it's enum
handling asymmetrical (inconsistent from a user's point of view) for clients
and servers.
The options for CXF are:
1. If CXF wants to support fromValue() on server side, it should also support
value() on the client side, otherwise it can't produce what it can consume.
2. Drop support for fromValue() on server side, provide a JAXB enum
ParamConverterProvider that users can configure on the client and server side.
Either way, CXF should treat JAXB enums as a producer and consumer consistently.
> JAX-RS client should use Enum.value() instead of toString()
> -----------------------------------------------------------
>
> Key: CXF-6287
> URL: https://issues.apache.org/jira/browse/CXF-6287
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 3.0.4
> Reporter: Dhiraj Bokde
> Assignee: Sergey Beryozkin
> Priority: Minor
> Fix For: NeedMoreInfo
>
>
> A JAX-RS endpoints that uses an JAXB enumeration as a parameter marshals it
> using {{toString()}} instead of its {{public String value()} method.
> This results in invalid values being marshaled for values, such as
> {{STATUS_UPDATE}} instead of {{status-update}}.
> This requires writing a custom enumeration ParamConverterProvider. Since all
> JAXB enumerations follow standard method patterns for marshaling {{public
> String value()}} and unmarshaling {{public static T fromValue(String
> value)}}, they should be handled by CXF by default.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)