[jira] [Commented] (CAMEL-7457) [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header

2014-06-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14021187#comment-14021187
 ] 

ASF GitHub Bot commented on CAMEL-7457:
---

Github user jfarrell closed the pull request at:

https://github.com/apache/camel/pull/161


 [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header
 --

 Key: CAMEL-7457
 URL: https://issues.apache.org/jira/browse/CAMEL-7457
 Project: Camel
  Issue Type: Bug
  Components: camel-cxf
Affects Versions: 2.12.3
Reporter: Seiji Sogabe
 Fix For: 2.12.4, 2.13.2, 2.14.0


 Content negotiation does not work correctly.
 I create service class and spring xml as follows.
 {code:title=CustomerService.java}
 @Path(/customer)
 public class CustomerService {
 
 @GET
 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
 public Customers getCustomers() {
 return null;
 }
 }
 {code}
 {code:xml}
 cxf:rsServer xmlns:cxf=http://camel.apache.org/schema/cxf;
   id=rsServer
   address=http://localhost:/rsServer;
   loggingFeatureEnabled=true
   loggingSizeLimit=200 
 cxf:serviceBeans
 ref bean=CustomerService /
 /cxf:serviceBeans
 cxf:providers
 ref bean=jettisonProvider /
 /cxf:providers
 /cxf:rsServer
 
 !-- provider --
 bean id=jettisonProvider 
 class=org.apache.cxf.jaxrs.provider.json.JSONProvider /
 
 !-- interface --
 bean id=CustomerService 
 class=com.buildria.camel.cxf.negotiation.CustomerService /
 !-- Concrete class --
 bean id=CustomerServiceImpl 
 class=com.buildria.camel.cxf.negotiation.CustomerServiceImpl /
 
 camelContext xmlns=http://camel.apache.org/schema/spring;
  
 route 
 !-- (1) SimpleConsumer BindingStyle --
 from uri=cxfrs://bean://rsServer?bindingStyle=SimpleConsumer /
 !-- (2) Default BindingStyle --
 !-- from uri=cxfrs://bean://rsServer /--
 
 choice
 when
 simple$simple{headers.operationName} == 
 'getCustomers'/simple
 bean ref=CustomerServiceImpl method=getCustomers /
 /when
 otherwise
 setHeader headerName=CamelHttpResponseCode
 constant404/constant
 /setHeader
 /otherwise
 /choice
 /route
 /camelContext
 {code}
 A) I tested it with curl command like this.
 {noformat}
 $ curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ 
 {customers:{customers:{address:Japan,name:Ken}}}sogabe@emilia 
 ~/src/camel/camel-rest-cxfrs [2.10.6] 2014/05/22 午後 23:15:56 
 $ LANG=C curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json
  
  HTTP/1.1 200 OK
  Accept: application/json
  breadcrumbId: ID-emilia-46343-1400768103395-0-7
  Content-Type: application/json
  Date: Thu, 22 May 2014 14:16:12 GMT
  Host: localhost:
  User-Agent: curl/7.36.0
  Transfer-Encoding: chunked
 * Server Jetty(8.1.14.v20131031) is not blacklisted
  Server: Jetty(8.1.14.v20131031)
  
 * Connection #0 to host localhost left intact
 {customers:{customers:{address:Japan,name:Ken}}}
 {noformat}
 *I got a reponse as a JSON format. It's OK!*
 B) But if Content-Type: application/xml  specified,
 {noformat}
 $ LANG=C curl  -H Accept: application/json  -H Content-Type: 
 application/xml http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json
  Content-Type: application/xml
  
  HTTP/1.1 200 OK
  Accept: application/json
  breadcrumbId: ID-emilia-46343-1400768103395-0-9
  Content-Type: application/xml
  Date: Thu, 22 May 2014 14:19:17 GMT
  Host: localhost:
  User-Agent: curl/7.36.0
  Transfer-Encoding: chunked
 * Server Jetty(8.1.14.v20131031) is not blacklisted
  Server: Jetty(8.1.14.v20131031)
  
 * Connection #0 to host localhost left intact
 ?xml version=1.0 encoding=UTF-8 
 standalone=yes?customerscustomersaddressJapan/addressnameKen/name/customers/customers
 {noformat}
 *I got a response as a xml format. It 

[jira] [Commented] (CAMEL-7457) [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header

2014-05-25 Thread Seiji Sogabe (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14008331#comment-14008331
 ] 

Seiji Sogabe commented on CAMEL-7457:
-

I created a pull request https://github.com/apache/camel/pull/161

 [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header
 --

 Key: CAMEL-7457
 URL: https://issues.apache.org/jira/browse/CAMEL-7457
 Project: Camel
  Issue Type: Bug
  Components: camel-cxf
Affects Versions: 2.12.3
Reporter: Seiji Sogabe

 I create service class and spring xml as follows.
 {code:title=CustomerService.java}
 @Path(/customer)
 public class CustomerService {
 
 @GET
 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
 public Customers getCustomers() {
 return null;
 }
 }
 {code}
 {code:xml}
 cxf:rsServer xmlns:cxf=http://camel.apache.org/schema/cxf;
   id=rsServer
   address=http://localhost:/rsServer;
   loggingFeatureEnabled=true
   loggingSizeLimit=200 
 cxf:serviceBeans
 ref bean=CustomerService /
 /cxf:serviceBeans
 cxf:providers
 ref bean=jettisonProvider /
 /cxf:providers
 /cxf:rsServer
 
 !-- provider --
 bean id=jettisonProvider 
 class=org.apache.cxf.jaxrs.provider.json.JSONProvider /
 
 !-- interface --
 bean id=CustomerService 
 class=com.buildria.camel.cxf.negotiation.CustomerService /
 !-- Concrete class --
 bean id=CustomerServiceImpl 
 class=com.buildria.camel.cxf.negotiation.CustomerServiceImpl /
 
 camelContext xmlns=http://camel.apache.org/schema/spring;
  
 route 
 !-- (1) SimpleConsumer BindingStyle --
 from uri=cxfrs://bean://rsServer?bindingStyle=SimpleConsumer /
 !-- (2) Default BindingStyle --
 !-- from uri=cxfrs://bean://rsServer /--
 
 choice
 when
 simple$simple{headers.operationName} == 
 'getCustomers'/simple
 bean ref=CustomerServiceImpl method=getCustomers /
 /when
 otherwise
 setHeader headerName=CamelHttpResponseCode
 constant404/constant
 /setHeader
 /otherwise
 /choice
 /route
 /camelContext
 {code}
 A) I tested it with curl command like this.
 {noformat}
 $ curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ 
 {customers:{customers:{address:Japan,name:Ken}}}sogabe@emilia 
 ~/src/camel/camel-rest-cxfrs [2.10.6] 2014/05/22 午後 23:15:56 
 $ LANG=C curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json
  
  HTTP/1.1 200 OK
  Accept: application/json
  breadcrumbId: ID-emilia-46343-1400768103395-0-7
  Content-Type: application/json
  Date: Thu, 22 May 2014 14:16:12 GMT
  Host: localhost:
  User-Agent: curl/7.36.0
  Transfer-Encoding: chunked
 * Server Jetty(8.1.14.v20131031) is not blacklisted
  Server: Jetty(8.1.14.v20131031)
  
 * Connection #0 to host localhost left intact
 {customers:{customers:{address:Japan,name:Ken}}}
 {noformat}
 *I got a reponse as a JSON format. It's OK!*
 B) But if Content-Type: application/xml  specified,
 {noformat}
 $ LANG=C curl  -H Accept: application/json  -H Content-Type: 
 application/xml http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json
  Content-Type: application/xml
  
  HTTP/1.1 200 OK
  Accept: application/json
  breadcrumbId: ID-emilia-46343-1400768103395-0-9
  Content-Type: application/xml
  Date: Thu, 22 May 2014 14:19:17 GMT
  Host: localhost:
  User-Agent: curl/7.36.0
  Transfer-Encoding: chunked
 * Server Jetty(8.1.14.v20131031) is not blacklisted
  Server: Jetty(8.1.14.v20131031)
  
 * Connection #0 to host localhost left intact
 ?xml version=1.0 encoding=UTF-8 
 standalone=yes?customerscustomersaddressJapan/addressnameKen/name/customers/customers
 {noformat}
 *I got a response as a xml format. It should be JSON format.*
 C) replace SimpleConsumer with Default style.
 ( (2) in spring.xml)
 {noformat}
  $ LANG=C curl  -H 

[jira] [Commented] (CAMEL-7457) [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header

2014-05-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14008330#comment-14008330
 ] 

ASF GitHub Bot commented on CAMEL-7457:
---

GitHub user ssogabe opened a pull request:

https://github.com/apache/camel/pull/161

CAMEL-7457 Does not override the Content-Type header of CXF response



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ssogabe/camel CAMEL-7457

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/161.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #161


commit f3fb418f95bdd813ec80e22f1f530d4cf24e71d5
Author: Seiji Sogabe sog...@buildria.com
Date:   2014-05-25T12:44:14Z

CAMEL-7457 Does not override the Content-Type header of CXF response




 [camel-cxf] cxfrs: SimpleConsumer does not honur Accept header
 --

 Key: CAMEL-7457
 URL: https://issues.apache.org/jira/browse/CAMEL-7457
 Project: Camel
  Issue Type: Bug
  Components: camel-cxf
Affects Versions: 2.12.3
Reporter: Seiji Sogabe

 I create service class and spring xml as follows.
 {code:title=CustomerService.java}
 @Path(/customer)
 public class CustomerService {
 
 @GET
 @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
 public Customers getCustomers() {
 return null;
 }
 }
 {code}
 {code:xml}
 cxf:rsServer xmlns:cxf=http://camel.apache.org/schema/cxf;
   id=rsServer
   address=http://localhost:/rsServer;
   loggingFeatureEnabled=true
   loggingSizeLimit=200 
 cxf:serviceBeans
 ref bean=CustomerService /
 /cxf:serviceBeans
 cxf:providers
 ref bean=jettisonProvider /
 /cxf:providers
 /cxf:rsServer
 
 !-- provider --
 bean id=jettisonProvider 
 class=org.apache.cxf.jaxrs.provider.json.JSONProvider /
 
 !-- interface --
 bean id=CustomerService 
 class=com.buildria.camel.cxf.negotiation.CustomerService /
 !-- Concrete class --
 bean id=CustomerServiceImpl 
 class=com.buildria.camel.cxf.negotiation.CustomerServiceImpl /
 
 camelContext xmlns=http://camel.apache.org/schema/spring;
  
 route 
 !-- (1) SimpleConsumer BindingStyle --
 from uri=cxfrs://bean://rsServer?bindingStyle=SimpleConsumer /
 !-- (2) Default BindingStyle --
 !-- from uri=cxfrs://bean://rsServer /--
 
 choice
 when
 simple$simple{headers.operationName} == 
 'getCustomers'/simple
 bean ref=CustomerServiceImpl method=getCustomers /
 /when
 otherwise
 setHeader headerName=CamelHttpResponseCode
 constant404/constant
 /setHeader
 /otherwise
 /choice
 /route
 /camelContext
 {code}
 A) I tested it with curl command like this.
 {noformat}
 $ curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ 
 {customers:{customers:{address:Japan,name:Ken}}}sogabe@emilia 
 ~/src/camel/camel-rest-cxfrs [2.10.6] 2014/05/22 午後 23:15:56 
 $ LANG=C curl  -H Accept: application/json  
 http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json
  
  HTTP/1.1 200 OK
  Accept: application/json
  breadcrumbId: ID-emilia-46343-1400768103395-0-7
  Content-Type: application/json
  Date: Thu, 22 May 2014 14:16:12 GMT
  Host: localhost:
  User-Agent: curl/7.36.0
  Transfer-Encoding: chunked
 * Server Jetty(8.1.14.v20131031) is not blacklisted
  Server: Jetty(8.1.14.v20131031)
  
 * Connection #0 to host localhost left intact
 {customers:{customers:{address:Japan,name:Ken}}}
 {noformat}
 *I got a reponse as a JSON format. It's OK!*
 B) But if Content-Type: application/xml  specified,
 {noformat}
 $ LANG=C curl  -H Accept: application/json  -H Content-Type: 
 application/xml http://localhost:/rsServer/customer/ -v
 * Hostname was NOT found in DNS cache
 *   Trying ::1...
 * connect to ::1 port  failed: Connection refused
 *   Trying 127.0.0.1...
 * Connected to localhost (127.0.0.1) port  (#0)
  GET /rsServer/customer/ HTTP/1.1
  User-Agent: curl/7.36.0
  Host: localhost:
  Accept: application/json