Freeman already mentioned the interceptor  and thread safety issue.  However, 
there might be another issue.

I'm not sure you can set a specific "Host" header.   The HttpURLConnection will 
always output a Host header as that's more or less required for HTTP 1.1.   It 
should be setting the Host header to whatever is the "host" part of the 
endpoint address URL.

Dan


On Jun 17, 2013, at 5:04 AM, Jose María Zaragoza <[email protected]> wrote:

> Hello:
> 
> I'm using Apache CXF 2.7.3 to invoke a WS from a servlet instance.
> So I defined a proxy client with <jaxws:client> and I injected it to that
> servlet instance.
> 
> 
> I need to set Host HTTP header when invoking remote WS.
> And it always will be the same value ( the remote host )
> 
> I would like to define under <http-conduit> configuration but i don't know
> if this is possible
> Another option is to create a outgoing interceptor and define this header,
> but I would prefer to define it in XML context file.
> 
> Other question is about thread-safe behaviour:
> as I told you , I inject that client ( proxy ) to servlet instance.
> Can I add HTTP header by code in a thread-safe way ?
> 
> I've read about
> 
> ((BindingProvider)proxy).getRequestContext().put("thread.local.request.context",
> "true");
> 
> and I could execute this code when I inject the proxy client ( if you say
> to me that to modify HTTP headers can be a problem )
> Or can I define this property in XML context ?
> 
> 
> Thanks and regards

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to