I have a Test Client which makes Restlet Request as below :
public class TestRestlet {
public static void main(String[] args) throws IOException {
CookieHandler.setDefault(new CookieManager( null, CookiePolicy.ACCEPT_ALL
));
ClientResource resource = getClientResource();
Representation rep = resource.get();
System.out.println(rep.getText());
}
private static ClientResource getClientResource() {
String resouceURL =
"http://localhost:8080/ActivitiSampleProject/service/process-definitions?suspended=false";
CookieSetting cookie1 = new CookieSetting("USER",
"qdny6HjWY0HONvWoyufBWemrDE+5IcdsssssK0E8UGmu5RKPF7h0BWKvBPSn+Kucb82Aq");
cookie1.setDomain(".abc.com");
cookie1.setPath("/");
cookie1.setMaxAge(-1);
ClientResource resource = new ClientResource(resouceURL);
resource.getRequest().getCookies().add(cookie1);
return resource;
}
}
At Restlet Servlet I want to read these cookies from request and send them back
to calling client to fetch some information based on the cookie.
But I am unable to retrieve the cookies : I have set my debugger at service
method of org.restlet.ext.servlet.ServerServlet and the request has no cookies.
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
.......
}
Is this the correct way to set cookies in request what am i doing wrong.?
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3089938