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 2016/05/06 10:01:12 UTC
[jira] [Resolved] (CXF-6796) Update PrimitiveTextProvider to write
and read all Objects
[ https://issues.apache.org/jira/browse/CXF-6796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-6796.
-----------------------------------
Resolution: Later
Assignee: Sergey Beryozkin (was: Jim Ma)
May be later if needed
> Update PrimitiveTextProvider to write and read all Objects
> -----------------------------------------------------------
>
> 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
> Priority: Minor
>
> 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)