Return-Path: X-Original-To: apmail-cxf-users-archive@www.apache.org Delivered-To: apmail-cxf-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E421D4FC for ; Tue, 14 May 2013 14:30:35 +0000 (UTC) Received: (qmail 74656 invoked by uid 500); 14 May 2013 14:30:33 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 74186 invoked by uid 500); 14 May 2013 14:30:25 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 72851 invoked by uid 99); 14 May 2013 14:30:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 14:30:21 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: encountered temporary error during SPF processing of domain of glen.mazza@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 14:30:16 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1UcGES-000078-C8 for users@cxf.apache.org; Tue, 14 May 2013 07:29:36 -0700 Date: Tue, 14 May 2013 07:29:36 -0700 (PDT) From: Glen Mazza To: users@cxf.apache.org Message-ID: <1368541776367-5727657.post@n5.nabble.com> In-Reply-To: <518D2004.3010807@gmail.com> References: <5183F114.7090309@gmail.com> <5183FB7F.3080203@gmail.com> <518415DD.9090500@gmail.com> <518461CD.9060109@gmail.com> <5186A8EB.2010603@gmail.com> <5188E9CF.5070008@gmail.com> <5189761A.5080901@gmail.com> <518D2004.3010807@gmail.com> Subject: Re: REST sample works with CXF 2.6.2 but not CXF 2.7.4... MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Glen Mazza wrote >> >> Ok, I've looked into it closer. The reason it did not work with CXF >> 2.7.6 was that Jackson provider is not typed to support >> application/x+javascript. Setting "application/json" on JSONP in >> interceptor is needed to get the runtime successfully selecting the >> Jackson provider, however in CXF 2.7.6 the way the response type is >> handled has changed (in the better way), so what happened was that >> JSONP out pre-stream interceptor was actually setting >> >> "application/x+javascript" (so that a proper response type is >> returned), but it does it too early actually though that worked in CXF >> 2.6.7 as this type was not affecting the selection of MBW. >> >> Basically, if you update your example to set a mediaType property on >> the out stream interceptor as "application/json" the example will >> start working, but that will return "application/json" content type to >> the browser. >> >> I've just added JAX-RS 2.0 out filter which should be used from now >> on, it will set a response content type after Jackson has been >> selected but before it is actually invoked, in the end resulting in a >> proper content type returned too, so remove >> >> bean.getOutInterceptors().add(new JsonpPreStreamInterceptor()); >> >> and add >> >> providerList.add(new >> org.apache.cxf.jaxrs.provider.jsonp.JsonpJaxrsWriterInterceptor()); >> >> It is a long story :-), but it has become better. And IMHO is still >> cleaner than using JSONPadding objects within the application code >> >> > > Hmm, I made the change: > https://github.com/gmazza/jersey-samples-on-cxf/commit/811d97be876286bfe62f2bc2e13667a25a0e5bfd > > But still isn't working: > curl -HAccept:application/x+javascript > http://localhost:9998/jsonp/changes?_jsonp=myCallback > No message body writer has been found for response class LinkedList.); jsonp example working now with 2.7.6-SNAPSHOT -- I forgot to set the media type as you detailed above. We're done. Thanks, Glen -- View this message in context: http://cxf.547215.n5.nabble.com/REST-sample-works-with-CXF-2-6-2-but-not-CXF-2-7-4-tp5727173p5727657.html Sent from the cxf-user mailing list archive at Nabble.com.