Hi
On 29/06/12 05:39, kdesin wrote:
Hi All/Sergey,
To explain a bit more:
WebClient client =WebClient.create("myURL");
client.type("text/html");
client.accept("text/html");
HTTPClientPolicy hcp=new HTTPClientPolicy();
hcp.setConnectionTimeout(6000);
hcp.setCookie("hello");
Map<String, String> headers = new HashMap<String, String>();
WebClient.getConfig(client).getHttpConduit().setClient(hcp);
It is possible to configure HTTPConduit to sent HTTP headers but I think
you should prefer working with WebClient API because other conduits are
already supported so it's better to work with a higher level API.
For example, you can do
client.cookie(Cookie.valueOf("a=b"));
or
client.header("Cookie", "a=b");
System.out.println("Cookies:"+WebClient.getConfig(client).getHttpConduit().getCookies());
System.out.println("headers:"+client.getHeaders());
resp= client.get();
*Output:*
Cookies:{}
HTTPConduit.getCookies returns the Set-Cookie values from the response.
You can also get them from WebClient.getResponse()
Cheers, Sergey
headers:{Content-Type=[text/html], Accept=[text/html]}
I want to understand how I can print the entire request header before
sending the request to the remote service as I am unable to see any cookies
being printed which I have set.I even used the requestContext method to set
the headers in a HashMap but with no luck.
Hope I am clear.
-----
Saludos
Kartheek
--
View this message in context:
http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710453.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com