cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: How to read Cookies in CXF Client
Date Sun, 19 Dec 2010 14:00:17 GMT
Hi

You can do it similarly to the way you customize Content-Type & Accept (note
- you only need to do it if you'd like to override the information the proxy
has already got after introspecting the interface/resource object).

So you can do

proxy.login();

Response r = WebClient.client(proxy).getResponse();
List<Object> cookies = r.getMetadata().get("JSESSIONID");

hope it helps
Sergey

On Sat, Dec 18, 2010 at 10:53 AM, mike <mike@3-egg.ch> wrote:

>
> Does anybody know, how to read the JSESSIONID cookie? I'm sure, that the
> cookie is set by the server.
>
> I try this:
>
> this.service = JAXRSClientFactory.create("http://localhost",
> RegistrationService.class);
>
> this.client =
>
> WebClient.client(this.service).accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);
>
> this.service.login(loginCredentials); // server call
>
> ClientConfiguration config = WebClient.getConfig(this.service);
> HTTPConduit conduit1 = config.getHttpConduit();
> Map cookies = conduit1.getCookies(); //<- is empty
>
> String str =
> WebClient.getConfig(this.service).getHttpConduit().getClient().getCookie();
> //<-is null
>
> What am i doing wrong?
> Any hints?
> Thanks!!
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/How-to-read-Cookies-in-CXF-Client-tp3310363p3310363.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message