cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Resolved] (CXF-6287) JAX-RS client should use Enum.value() instead of toString()
Date Wed, 11 Mar 2015 13:05:38 GMT


Sergey Beryozkin resolved CXF-6287.
       Resolution: Won't Fix
    Fix Version/s: NeedMoreInfo
         Assignee: Sergey Beryozkin

Unfortunately defaulting to value() will be too sensitive. JAX-RS 2.0 Client API clearly states
that toString() are to be used for Object parameters (query, header, etc), see the relevant
WebTarget method docs. Some Enums may not be JAXB-generated and it is also possible to override
toString in cases where custom enums are created manually.

This is one of the reasons ParamConverter is there, when the ambiguity exists.

I'd like to encourage you to seek further clarifications on the JAX-RS users list - perhaps
it may sense to update the spec API text 

> JAX-RS client should use Enum.value() instead of toString()
> -----------------------------------------------------------
>                 Key: CXF-6287
>                 URL:
>             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

View raw message