httpurlconnection session problem

i call from servletA over a httpurlconnection servletB. the servletB can't read the session which are written from servletA. who can solution the problem?rweb
[180 byte] By [muckefuk] at [2007-9-26 2:35:54]
# 1

Here is how I did it. url_ is a URL.

sessionCookie_ is something like "jsessionid=ekjhdsus01".

You get the session cookie with session.getId();

HttpURLConnection dataCon = null;

dataCon = (HttpURLConnection) url_.openConnection();

// Set up the connection to be POST, do output, and set the session cookie

dataCon.setDoOutput(true);

dataCon.setRequestMethod("POST");

if (sessionCookie_ != null) {

dataCon.setRequestProperty("Cookie", sessionCookie_);

}

OutputStream out = dataCon.getOutputStream();

...

WynEaston at 2007-6-29 10:02:56 > top of Java-index,Archived Forums,Java Programming...
# 2

Hi,

I cannot answer to your question, but I have a question for you.

I don't know much about jsessionid.

you pass it thru the URL like that 1)www.mysite.com/page.jsp;jsessionid=123

2)123 = is session.getId?

3) In the page called (page.jsp), do I have to put some code to make the session associate with the pass one (querystring or something)?

4) May I pass jsessionid via an URL in a jsp or it is limited to servlet?

Great thanks!

MathieuO at 2007-6-29 10:02:56 > top of Java-index,Archived Forums,Java Programming...