HTTP Response Headers - 7650
I've a MIDlet that use HTTPConnection (POST) to establish a connection to a servlet.
I try to use URL-rewriting for Session Tracking:
HttpSession session = req.getSession(true);
String sIncomingURL = req.getRequestURL().toString();
String sURLwithID = res.encodeURL(sIncomingURL);
Why in my MIDlet this http.getHeaderField("rewriting URL") return always null value?:
//##### URL-Rewriting #####
sServletURLWidthID = http.getHeaderField("rewriting URL");
if (sServletURLWidthID != null) _sURLServlet = sServletURLWidthID;
sServletURLWidthID is always null
Can it be the WAP Gateway?
Which type of Gateway do I have to use?
servlet> res.setHeader("rewritingURL", sURLwithID);
midlet> sServletURLWidthID = http.getHeaderField("rewriting URL");
is not the same field. there is a space in the getHeaderField call (rewriting_Url)
well its maybe not the thing but its not how its supposed to be :-)
yes I know, this is not the problem it's only an error writing the email.
I'm sure that the two keys are the same.
I have the same problem with my nokia 7650.
String cookie = conn.getHeaderField("Set-cookie");
return ever null on mobile and work fine on the emulator.
Ask anyone know if 7650 needed ability cookie??
Two comments ...
Using cookies to track sessions in J2ME is a *bad* idea. This is because on those handsets which implement http over WAP, most WAP gateways have the habit of munging or simply discarding cookies. You're much better off implementing the session as a piece of application data.
Secondly, the 7650 (or at least my 7650) implements http over TCP/IP so there is no WAP gateway involved.
Thank you for your comments.