aspose file tools*
The moose likes Servlets and the fly likes why new URLConnection in java application can't keep session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

why new URLConnection in java application can't keep session

chen juxing
Greenhorn

Joined: Feb 19, 2003
Posts: 4
Hi,
My java-application client work this way:
first request for book list, then request for infomation of a special book by index. But I find the second request can't store the cookie from first session.
Here is my relative code:
URL url = new URL(URLAdresse);
URLConnection urlConnection = url.Connection();
if (!cookie.equals("")){
urlConnection.setRequestProperty("cookie", cookie);
}
urlConnection.connect();
kindly tell me why, thks!
[ February 20, 2003: Message edited by: chen juxing ]

can't stop learning new
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Originally you started to ask this question in this very old thread... http://www.coderanch.com/t/347115/Servlets/java/session

I've closed that one, everyone please continue the conversation in this one.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: why new URLConnection in java application can't keep session