I even tried a processor like this using HttpClient API. Still i couldn't
make it work.
*public class Http4Client implements Processor{
private static String downloadApiData(String url) throws Exception {
HttpClient client = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader("User-Agent", USER_AGENT);
httpGet.setHeader("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
httpGet.setHeader("Accept-Language", "en-US,en;q=0.5");
HttpResponse response = client.execute(httpGet);
System.out.println("Got response ->"+response.toString());
BufferedReader rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
System.out.println(line);
}
return result.toString();
}
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(downloadApiData(exchange.getProperty("apiUrl").toString()));
}
}
*
-----
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel &
Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-http4-OperationTimeout-tp5801630p5801631.html
Sent from the Camel - Users mailing list archive at Nabble.com.