Sorry for all because my pc does not have chinese input and is restricted by company, so I have to type in english.
I want to ask, I got an android apps and a servlet in server.
When i first login from the apps, the authentication is done in server and create a new session.
Everything is fine. When I post data again from the apps, I am not able to get the previous session in server as it returns null.
Below is the sample codes that I have written.
Apprieciate if anyone could help me on this matter.
Thank you very much. 
// This is the part where after login the session is created. This is the code in servlet. session = createSession(request, outPool); String sessionid = session.getId(); response.setHeader("SESSION_ID", "JSESSIONID="+ sessionid);
//This is the part where android apps post data after login. Set the cookie into the request header to send to servlet
URL url = new URL(sbURL.toString());
conn = (HttpsURLConnection)url.openConnection();
conn.setRequestMethod(" OST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if(MyApps.cookie != null)
{
conn.setRequestProperty("COOKIE", MyApps.cookie); } //sending content output = conn.getOutputStream();
output.write(szInput.getBytes());
//This is the part in servlet where it receives the data posting from android apps.
szUserIP = request.getHeader(" ROXY-IP");
sysPool.set("SERVER_IP", szServerIP);
sysPool.set("REMOTE_IP", szUserIP);
String szQString = request.getQueryString();
String szUserAgent = request.getHeader("USER-AGENT");
//Here the session always get null as supposingly it should retrive the previous session created during login
session = request.getSession(false);
|