My app logins into a server, which sets some cookies for authentication on subsequent connections. On the next connection, in another form, the server sees the cookies. When the app goes to a third form, the server does not see the initial login cookies. I use the same connection code for the three connections to the server.
Picker establishmentPicker = new Picker();
establishmentPicker.setType(Display.PICKER_TYPE_STRINGS);
//
ConnectionRequest r = new ConnectionRequest() {
//BufferedReader br;
@Override
protected void postResponse() {
//findDest(c)
}
};
r.setUrl("https://barq-160619.appspot.com/estabappJ");
r.setPost(true);
r.setCookiesEnabled(true);
r.setUseNativeCookieStore(true);
Cookie.setAutoStored(true);
Cookie.isAutoStored();
System.out.println("Getting Establishments");
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
r.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueueAndWait(r);
JSONParser p = new JSONParser();
String[] places = new String[5];
Hashtable h;
Hashtable t;
Hashtable h2;
Object o;
// Map<String, String> data = p.parseJSON(r);
try {
// Map<String, Object> h = p.parse(new InputStreamReader(new ByteArrayInputStream(r.getResponseData()), "UTF-8"));
h = p.parse(new InputStreamReader(new ByteArrayInputStream(r.getResponseData()), "UTF-8"));
} catch (IOException ex) {
h = null;
System.out.println("Establishment list = null");
}
Is there a way to for the persisting of the cookies? Do I need to set an expiration on the initial setting of the cookies? Or am I missing something on the app side?