Hi,

Generally, you can set any http header in CXF clients.

For JAX-WS clients you need something like this:

Client proxy = ClientProxy.getClient(serviceClient);

Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("MyHeaderName", Arrays.asList("MyHeaderValue"));

// Add HTTP headers to the web service request
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);

For JAX-RS clients:

Client client = ClientBuilder.newClient();
Response response = 
client.target("http://examples.jaxrs.com/";).request("text/plain").header("MyHeaderName
 ", " MyHeaderValue ").get();

Regards,
Andrei.

> -----Original Message-----
> From: mn [mailto:[email protected]]
> Sent: Mittwoch, 30. November 2016 18:01
> To: [email protected]
> Subject: Unable to set "keep-Alive:timeout=<duration>" inside CXF header
> 
> Hi I am using cxf 2.7.3.
> 
> How do we set keep-Alive: timeout=<duration> inside CXF client header?
> According to
> https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html, there are
> Keep-Alive: timeout element and connection: Keep-Alive element inside
> httpHeader.
> 
> We can set connection=Keep-Alive element inside our CXF client through
> httpClientPolicy but not "keep-Alive: timeout=<duration>".
> I am looking at the source code cxf 2.7.3 as well as 3.1.8 (latest) but could 
> not
> find any api to set "keep-Alive: timeout" in HttpClientPolicy.
> 
> I hope someone can help me on this issue.
> 
> Thanks,
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Unable-to-set-
> keep-Alive-timeout-duration-inside-CXF-header-tp5775413.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to