Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B6A4A174E6 for ; Thu, 3 Mar 2016 03:10:18 +0000 (UTC) Received: (qmail 4137 invoked by uid 500); 3 Mar 2016 03:10:18 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 4079 invoked by uid 500); 3 Mar 2016 03:10:18 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 4047 invoked by uid 99); 3 Mar 2016 03:10:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Mar 2016 03:10:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 3D2DC2C1F58 for ; Thu, 3 Mar 2016 03:10:18 +0000 (UTC) Date: Thu, 3 Mar 2016 03:10:18 +0000 (UTC) From: "Jim Ma (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-6796) Improve or extend StringTextProvider to write an Object MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)