How can I access HTTP headers in Spring-ws endpoint?
My code looks like this:
public class MyEndpoint extends AbstractMarshallingPayloadEndpoint {
You can add these methods. The TransportContextHolder will hold some data related to transport (HTTP in this case) in a thread local variable. You can access HttpServletRequest from the TransportContext.
protected HttpServletRequest getHttpServletRequest() {
TransportContext ctx = TransportContextHolder.getTransportContext();
return ( null != ctx ) ? ((HttpServletConnection ) ctx.getConnection()).getHttpServletRequest() : null;
}
protected String getHttpHeaderValue( final String headerName ) {
HttpServletRequest httpServletRequest = getHttpServletRequest();
return ( null != httpServletRequest ) ? httpServletRequest.getHeader( headerName ) : null;
}