Hi,

BTW, it's not what the original topic is about but very closely related:

I just discovered that if the HTTP server returns an error code
(e.g. sendError(500) in an HttpServlet) then a Java client using
URLConnection
will bomb on IOException while trying to retrieve, e.g., getResponseCode(),
UNLESS URLConnection.getHeaderField() is called first.

Has anyone else encountered such a behaviour?  Nothing in the docs, web
sites
(bug parade, message boards), books and the JDK 1.2.2 source mentions that
this is the expected behaviour.  Burned a few days on this one...

I'm using the JDK 1.2.2 which comes with JBuilder 3.5 on Windows 2000 and
Tomcat 3.1 for debugging.

Cheers,

--Amos


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 22, 2000 12:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: GET POST Difference
>
>
> Let's suppose we are developing HttpClient.java program.
> when you request html or servlet through "GET".
> you should attach parameter string as "name=value" at end of URL.
> But when you request servlet or cgi through "POST"
> you should connect to WebServer as url
> "http://hostname/servlet/ServletName".
>
> URLConnection url = new
> URL("http://hostname/servlet/ServletName").openConnection();
> urlconnection.setDoOutput(true);
>                     PrintWriter printwriter = new
> PrintWriter(urlconnection.getOutputStream());
>                     printwriter.print("name=value&name=value");
>                     printwriter.close();
>
> And send parameters as string through OutputStream or Writer...
> Did you satisfy?
>
> ^^     <-- my eyes..

___________________________________________________________________________
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