149.15. 応答コードの取得
Exchange.HTTP_RESPONSE_CODE
を使用して Out メッセージヘッダーから値を取得することにより、HTTP コンポーネントから HTTP 応答コードを取得できます。
Exchange exchange = template.send("http://www.google.com/search", new Processor() { public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader(Exchange.HTTP_QUERY, constant("hl=en&q=activemq")); } }); Message out = exchange.getOut(); int responseCode = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);