-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
Description
What steps will reproduce the problem?
1. Try to add cookies to a RemoteService. cookies are not passed in the request:
CookieManager empSession = new CookieManager();
CookieStore cookieStore = empSession.getCookieStore();
cookieStore.add(new URI("http://example.com/gwtApp"), new HttpCookie("sessionToken", "123456789"));
empSession = new CookieManager(cookieStore, CookiePolicy.ACCEPT_ALL);
ExampleRemoteService exampleService = (ExampleRemoteService) SyncProxy.newProxyInstance(ExampleRemoteService.class, "http://example.com/gwtApp", "exampleSvc", empSession);
making a request like exampleService.exampleMethod() does not include the
cookie in the request
What is the expected output? What do you see instead?
In the header of the request, I'd expect to see:
"Cookie: sessionToken=123456789"
What version of the product are you using? On what operating system?
0.3.1
Please provide any additional information below.
Here's code to fix this. Add it to RemoteServiceSyncProxy.java after line 147
(connection.setRequestProperty...)
CookieStore store = cookieManager.getCookieStore();
String cookiesStr = "";
for(HttpCookie cookie : store.getCookies()) {
if(!"".equals(cookiesStr)) cookiesStr += "; ";
cookiesStr += cookie.getName() +"="+ cookie.getValue();
}
connection.setRequestProperty("Cookie", cookiesStr);
Original issue reported on code.google.com by david.bu...@sagebase.org on 22 Dec 2011 at 10:08
Reactions are currently unavailable