2016-02-24 53 views

回答

1

看到這個documentation

它在頭Exchange.HTTP_RESPONSE_CODE

3

嘗試是這樣的(輕微排列的Camel docu的):

Exchange exchange = template.send("https4://myhostname.com:443/myURL", new Processor() { 
    public void process(Exchange exchange) throws Exception { 
    exchange.getIn().setHeader(Exchange.HTTP_METHOD, GET); 
    } 
}); 
Message out = exchange.getOut(); 
int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); 

它也可能不經過工作處理器,因爲如果主體爲空,http4默認爲GET。