Ritin Mathur wrote:
>
> I have to make an application, which connects to a
> servlet over HTTP.
> ... maybe i can use the URLConnection class and make
> the connection to the servlet. but how do i create
> and send the cookies ?? and is making a connecton
> through the URLConnection class the same thing as
> using sockets ??
>
If you hunt around in the archives you'll find some
sample code (try search terms like "servlet cookie
urlconnection"). Quick answer is: cookies get sent
as HTTP headers, and yes, a URLConnection is going to
turn out to be using a socket.
But you'll be much happier in the long run if you
step back and spend an hour or two figuring out exactly
how all this stuff works. Good sources of information
include:
The Java Tutorial's section on networking at:
<URL:http://java.sun.com/docs/books/tutorial/?frontpage-spotlight>
The HTTP spec (rfc2616), available from:
<URL:http://www.rfc-editor.org/>
For info about what cookie headers look like:
<URL:http://www.rajivshah.com/Case_Studies/Cookies/CookiesLinks.html>
Finally, instead of using URLConnection, you might check
out the HTTPClient library. It's much niftier than Java's
built-in HTTP handling:
<URL:http://www.innovation.ch/java/HTTPClient/>
--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com
___________________________________________________________________________
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