简体   繁体   中英

Restlet - How to get cookies from a GET request

I'm making a get request using the Restlet api in a java application with this code:

// returns a Representation object
new ClientResponse("http://example.com/page").get(); 

I want to see the cookies which are sent in response to the get request.

You first need to create the ClientResource object, then get its representation, then the cookies:

ClientResource cr = new ClientResource("http://example.com/page");
Representation result = cr.get();
Series<Cookie> cookies = cr.getCookies();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM