camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robinhowlett <>
Subject CXF-RS, @QueryParam and @HeaderParam
Date Wed, 13 Apr 2011 22:55:45 GMT
In my context.xml I have defined a jaxrs:server with serviceBean referenced,
and both a cxf:rsServer and cxf:rsClient. 


My route is defined in RestTestRouteBuilder using Java DSL and is just:


My test case is using the producerTemplate to send to the cxfrs endpoint
defined by the cxf:rsServer and I include query parameters. A Processor sets
the ExchangePattern as InOut, and the inMessage has a HTTP_METHOD header set
to "GET" and a Response Class header to InputStream

Exchange exchange =
new Processor() {        
                public void process(Exchange exchange) throws Exception {
                    Message inMessage = exchange.getIn();
                    inMessage.setHeader(Exchange.HTTP_METHOD, "GET");
String response = exchange.getOut().getBody(String.class);
assertNotNull("The response should not be null ", response);
assertEquals("The response value is incorrect", "test", response);

My CXF service bean has paths set correctly and my "query" method is
expecting two @QueryParams

public class QueryService {
	public Response getSomething(@QueryParam("id") String id,
@QueryParam("orgId") String orgId) {
		return "test";

However when I run the test, the QueryParams are receving nothing (null);
after many tries, I realized that the parameters that were set on the URL
are actually coming in as of type @HeaderParam
	public Response getSomething(@HeaderParam("id") String id,
@HeaderParam("orgId") String orgId) {
		return "test";

What's happening to convert those to type @HeaderParam and how can I get
them as of type @QueryParam?

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message