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 588E17527 for ; Mon, 18 Jul 2011 21:39:26 +0000 (UTC) Received: (qmail 58483 invoked by uid 500); 18 Jul 2011 21:39:25 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 58426 invoked by uid 500); 18 Jul 2011 21:39:25 -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 57830 invoked by uid 99); 18 Jul 2011 21:39:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 21:39:24 +0000 X-ASF-Spam-Status: No, hits=-2001.1 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 21:39:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 94DEF422C7 for ; Mon, 18 Jul 2011 21:38:58 +0000 (UTC) Date: Mon, 18 Jul 2011 21:38:58 +0000 (UTC) From: =?utf-8?Q?=C5=81ukasz_Strzelecki_=28JIRA=29?= To: issues@cxf.apache.org Message-ID: <172993813.1802.1311025138606.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <474631704.1772.1311025017905.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (CXF-3667) Content negotiation & ResponseBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-3667?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] =C5=81ukasz Strzelecki updated CXF-3667: ----------------------------------- Description:=20 With creation of response without content, based on javax.ws.rs.core.Respon= se.ResponseBuilder. I get wrong Content-Type.=20 Sample of REST resource (This is not valid rest service, but I want only sh= ow strange behaviour) {code} package com.sozix.rest.service; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("/hello") public class HelloResource { =09// 1 =09@GET =09// 2 =09@Produces(MediaType.APPLICATION_JSON) =09public Response greeting() { =09=09// 3 =09=09return Response.noContent().build(); =09} } {code} At 1) No matter which kind of request (GET, POST, PUT, DELETE) i will invok= e. Issiue is the same. At 2) I set that method produces ONLY Content-type: application/json At 3) Constructing response without content, using javax.ws.rs.core.Respons= e.ResponseBuilder Invoking servcie $ curl *--header "Accept: application/json"* http://localhost:8080/hello -v I'm setting header that as client accept only JSON content type. {code} $ curl --header "Accept: application/json" http://localhost:8080/hello -v * About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /hello HTTP/1.1 > User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8q zl= ib/1. 2.5 libidn/1.18 libssh2/1.2.5 > Host: localhost:8080 > Accept: application/json > < HTTP/1.1 204 No Content < Content-Type: text/xml < Date: Mon, 18 Jul 2011 21:19:19 GMT < Server: Jetty(7.4.2.v20110526) < * Connection #0 to host localhost left intact * Closing connection #0 {code} But as you can see at response i'm getting Content-Type: *text/xml*. Which = is not i'm expecting. was: With creation of response without content, based on javax.ws.rs.core.Respon= se.ResponseBuilder. I get wrong Content-Type.=20 Sample of REST resource (This is not valid rest service, but I want only sh= ow strange behaviour) {code} package com.sozix.rest.service; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("/hello") public class HelloResource { =09// 1 =09@GET =09// 2 =09@Produces(MediaType.APPLICATION_JSON) =09public Response greeting() { =09=09// 3 =09=09return Response.noContent().build(); =09} } {code} At 1) No matter which kind of request (GET, POST, PUT, DELETE) i will invok= e issiue is the same. At 2) I set that method produces ONLY Content-type: application/json At 3) Constructing response without content, using javax.ws.rs.core.Respons= e.ResponseBuilder Invoking servcie $ curl *--header "Accept: application/json"* http://localhost:8080/hello -v I'm setting header that as client accept only JSON content type. {code} $ curl --header "Accept: application/json" http://localhost:8080/hello -v * About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /hello HTTP/1.1 > User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8q zl= ib/1. 2.5 libidn/1.18 libssh2/1.2.5 > Host: localhost:8080 > Accept: application/json > < HTTP/1.1 204 No Content < Content-Type: text/xml < Date: Mon, 18 Jul 2011 21:19:19 GMT < Server: Jetty(7.4.2.v20110526) < * Connection #0 to host localhost left intact * Closing connection #0 {code} But as you can see at response i'm getting Content-Type: *text/xml*. Which = is not i'm expecting. > Content negotiation & ResponseBuilder > ------------------------------------- > > Key: CXF-3667 > URL: https://issues.apache.org/jira/browse/CXF-3667 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.4.1 > Reporter: =C5=81ukasz Strzelecki > > With creation of response without content, based on javax.ws.rs.core.Resp= onse.ResponseBuilder. I get wrong Content-Type.=20 > Sample of REST resource (This is not valid rest service, but I want only = show strange behaviour) > {code} > package com.sozix.rest.service; > import javax.ws.rs.GET; > import javax.ws.rs.Path; > import javax.ws.rs.Produces; > import javax.ws.rs.core.MediaType; > import javax.ws.rs.core.Response; > @Path("/hello") > public class HelloResource { > =09// 1 > =09@GET > =09// 2 > =09@Produces(MediaType.APPLICATION_JSON) > =09public Response greeting() { > =09=09// 3 > =09=09return Response.noContent().build(); > =09} > } > {code} > At 1) No matter which kind of request (GET, POST, PUT, DELETE) i will inv= oke. Issiue is the same. > At 2) I set that method produces ONLY Content-type: application/json > At 3) Constructing response without content, using javax.ws.rs.core.Respo= nse.ResponseBuilder > Invoking servcie > $ curl *--header "Accept: application/json"* http://localhost:8080/hello = -v > I'm setting header that as client accept only JSON content type. > {code} > $ curl --header "Accept: application/json" http://localhost:8080/hello -v > * About to connect() to localhost port 8080 (#0) > * Trying 127.0.0.1... connected > * Connected to localhost (127.0.0.1) port 8080 (#0) > > GET /hello HTTP/1.1 > > User-Agent: curl/7.20.1 (i686-pc-cygwin) libcurl/7.20.1 OpenSSL/0.9.8q = zlib/1. > 2.5 libidn/1.18 libssh2/1.2.5 > > Host: localhost:8080 > > Accept: application/json > > > < HTTP/1.1 204 No Content > < Content-Type: text/xml > < Date: Mon, 18 Jul 2011 21:19:19 GMT > < Server: Jetty(7.4.2.v20110526) > < > * Connection #0 to host localhost left intact > * Closing connection #0 > {code} > But as you can see at response i'm getting Content-Type: *text/xml*. Whic= h is not i'm expecting. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira