Will Hardwick-Smith
Will Hardwick-Smith

Reputation: 1049

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.

Upvotes: 0

Views: 741

Answers (1)

Jerome Louvel
Jerome Louvel

Reputation: 2892

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();

Upvotes: 1

Related Questions