Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Looking for simple http request example with cxfrs in java

$
0
0
I have to use Content-Type on a GET request with null body, http, http4
doesn't work.
Follow Willem's answer, I am trying to use cxfrs.

From Willem :
I just found camel-cxfrs can set the content-type even with get request.
Maybe you can consider to use camel-cxfrs instead of camel-http4 component
to that job.
Full topic here
<http://grokbase.com/t/camel/users/141rpgmw38/http4-set-header-content-type-not-passing-through-to-the-http-request>

Can someone point me to a simple tutorial to do a get http request in java
dsl ?
Or tell me what I am missing in this code :

@Produce(uri = "direct:start")
protected ProducerTemplate template;

@Test
public void httpRequest() {
template.sendBody(null);

from("direct:start")
.setHeader(Exchange.HTTP_QUERY, constant("q=camel"))
.to("cxfrs://google.ca")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
IOUtils.toString(exchange.getOut().getBody(InputStream.class));

});

Here is stacktrace : http://pastebin.com/d9uSpmqj

Viewing all articles
Browse latest Browse all 5648

Trending Articles