Can the Camel Spring-WS component extract an HTTP header?
Environment
Red Hat JBoss Fuse 6.x
Issue
Can the Camel Spring-WS component make an HTTP header available?
Resolution
Headers can be obtained from the TransportContext, as seen below.
public class HeaderRetreivalProcessor implements Processor {
public void process(Exchange inEx) throws Exception {
TransportContext tctx = TransportContextHolder.getTransportContext();
HttpServletRequest rq = ((HttpServletConnection ) tctx.getConnection()).getHttpServletRequest();
String hdr = rq.getHeader("someHeader");
}
}
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
