Nic Ferrier <[EMAIL PROTECTED]> wrote:

>>>> web web <[EMAIL PROTECTED]> 22-Feb-01 4:03:15 AM >>>
>
>
> //presuming s is the open socket
>  OutputStream out=s.getOutputStream();
>  PrintWriter p=new PrintWriter(out,true);
>  p.println("GET /myservlet/ HTTP/1.0\r");
>  p.println("\r");
>
> that's it. You can then read the response from the input stream.
>
> This is not exactly good HTTP though. You should read the rfc2616 for
> more information about correct HTTP.
>
> Also try to use a URLConnection if possible. HttpURLConnection is
> quite a good class and will abstract most things for you.

The only problem I know of HttpURLConnection is that headers are stored in a
Hashtable, so, it _might_ happen that one HTTP header might get lost...
This happens usually with Cookies, when different Cookie: headers are sent
within the same response body... With HttpURLConnection you only get the
last one...

    Pier

--
----------------------------------------------------------------------------
Pier P. Fumagalli    Sun Microsystems    <mailto:[EMAIL PROTECTED]>

___________________________________________________________________________
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