Jozef Chocholacek wrote:
>
> // do not forget the last "\n" - HTTP request ends with empty line
> output.println("GET /TestServlet HTTP/1.0\n");
>

 Don't use PrintStream.println(), it's not going to work
cross platform the way you want.

 HTTP always wants a crlf pair as eol, but depending on the
platform, PrintStream is going to be putting different eol
characters. Using print("...\r\n\r\n") is still incorrect,
(since you can't be sure what the default locale looks
like) but has a much better chance of working correctly. To
be totally correct, you need to do things like write the
bytes on your own, or make sure PrintStream is constructed
with 'ASCII' as the encoding.

 Example: mac's use a cr instead of a windows-like crlf or
a unix-like lf, exercise for the reader to figure out what
happens with the above code...

--
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

Reply via email to