Hi,

I don't think you can add specific HTTP header through <http-conduit> 
configuration.

And for your scenario, any change on 
((BindingProvider)proxy).getRequestContext() isn't thread safe, please take a 
look at [1] to get more details, so you need specify 
thread.local.request.context as true in this case.

And IMO add an outInterceptor and change HTTP header per message on the fly 
should be the way to go, add an interceptor is easy in configuration file.

[1]http://cxf.apache.org/faq.html
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋



On 2013-6-17, at 下午5:04, Jose María Zaragoza 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

Reply via email to