3.13.3. 응답 코드 가져오기
Exchange.HTTP_RESPONSE_CODE
를 사용하여 출력 메시지 헤더에서 값을 가져와 AHC 구성 요소에서 HTTP 응답 코드를 가져올 수 있습니다.
Exchange exchange = template.send("ahc: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);