Hi,
Iam trying to invoke a java servlet from a java application.
This is the snoop.html that returns details about the HTTP request.

When I make the request from the browser, the Http header contains
the information about a cookie that holds the session id

However if the same servlet is invoked from the java application
there is no information about the cookie.

How do I enable cookies from my java client application.

I need to do this because the session id is held in the cookie and I
need to pass the cookie information to the successive servlet calls
that I will be making from my java application.

Here is the code:

import java.net.*;
import java.io.*;

public class URLReader
{
 public static void main(String[] args) throws Exception
 {
   URL yahoo = new URL("http://jserv.java.sun.com/snoop.html");

   BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        yahoo.openStream()));

   String inputLine;

   while ((inputLine = in.readLine()) != null)
   System.out.println(inputLine);
   in.close();
  }
}

Thanks for your help.

Regards
anand kulkarni



Enter your default signature here
Sent by Indya Messaging Service

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to