Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 46608 invoked from network); 25 Sep 2008 10:05:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Sep 2008 10:05:50 -0000 Received: (qmail 7313 invoked by uid 500); 25 Sep 2008 10:05:46 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 7270 invoked by uid 500); 25 Sep 2008 10:05:46 -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 7259 invoked by uid 99); 25 Sep 2008 10:05:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Sep 2008 03:05:46 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Sep 2008 10:04:44 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1Kinin-0007IC-0d for users@cxf.apache.org; Thu, 25 Sep 2008 03:05:17 -0700 Message-ID: <19666573.post@talk.nabble.com> Date: Thu, 25 Sep 2008 03:05:17 -0700 (PDT) From: wildPengiun To: users@cxf.apache.org Subject: Re: CXF REST Service In-Reply-To: <015401c91eef$228aab60$e002050a@IONAGLOBAL.COM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: Simon.Gash@gossinteractive.com References: <19665190.post@talk.nabble.com> <015401c91eef$228aab60$e002050a@IONAGLOBAL.COM> X-Virus-Checked: Checked by ClamAV on apache.org Works very well, thanks for that. Sergey Beryozkin wrote: > > Hi > > > In your method, instead of returning byte[] directly, return JAX-RS > Response and set > your byte[] on that Response, as well as the status code and the media > type : > > return Response.ok().type(theMediaType).entity(byteArray).build(); > > and you can remove @ProduceMime on the method itself. It will lead to all > of the input HTTP Accept values be accepted during a > method match, so you might want to do some additional matching in your > method based on the value of @Context HttpHeaders. You can do > this type of pre-match in a provate CXF filter if you do not want to do it > in the application code. > > Cheers, Sergey > > >> >> I have a simple REST (GET) that retrieves a binary from the server >> byte[]. My >> problem is that the @producemime attribute is static (set at design >> time). I >> will not know the type of media JPEG, Word Document etc until run-time. >> Is >> there a way that I can set the value of @producemime at run-time or is >> there >> another way of doing it ? >> >> Many thanks. >> -- >> View this message in context: >> http://www.nabble.com/CXF-REST-Service-tp19665190p19665190.html >> Sent from the cxf-user mailing list archive at Nabble.com. > > ---------------------------- > IONA Technologies PLC (registered in Ireland) > Registered Number: 171387 > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland > > -- View this message in context: http://www.nabble.com/CXF-REST-Service-tp19665190p19666573.html Sent from the cxf-user mailing list archive at Nabble.com.