cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Ma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6796) Improve or extend StringTextProvider to write an Object
Date Thu, 03 Mar 2016 03:10:18 GMT

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

Jim Ma commented on CXF-6796:
-----------------------------

Hi Sergey,  Sorry , I missed the jira update.  If we create another provider which is only
writeable for text/plain media type and get it registered, will it break other things ? 
Thanks,
Jim

> Improve or extend StringTextProvider to write an Object 
> --------------------------------------------------------
>
>                 Key: CXF-6796
>                 URL: https://issues.apache.org/jira/browse/CXF-6796
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.1.5
>            Reporter: Jim Ma
>            Assignee: Sergey Beryozkin
>             Fix For: 3.1.6
>
>
> CXF reports it can't find the message writer for  OrderModel class and text/plain content
type when the resource class like the following:  
> {code}
> @Produces("text/plain")
> @Path("order/{id}")
> public class OrderResource {
>    @GET
>     public OrderModel get(@PathParam("id") @CustomMax int id) {
>         return new OrderModel(id);
>     }
> }
> {code}
> It is required to change the return Class to String and explicitly invoke toString()
return the String value
> {code}. 
> @Produces("text/plain")
> @Path("order/{id}")
> public class OrderResource {
>     @GET
>     public String get(@PathParam("id") @CustomMax int id) {
>         return new OrderModel(id).toString();
>     }
> }
> {code}
> We can improve StringTextProvider to write the Object with toString value to remove the
return type must be String class restriction.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message