150.16.4. 응답 코드 가져오기

Exchange.HTTP_RESPONSE_CODE.HTTP_RESPONSE_CODE와 함께 Out 메시지 헤더에서 값을 가져와 HTTP4 구성 요소에서 HTTP 응답 코드를 가져올 수 있습니다.

Exchange exchange = template.send("http4://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);