On Tue, 28 Dec 1999, Craig R. McClanahan wrote:
> "Booth, Peter" wrote:
>
[...]
> > I have seen examples of code where a servlet sets
> > a respones error code:
> >
> > e.g.
> > res.sendError(res.SC_INTERNAL_SERVER_ERROR);
> >
> > Is there any way that an applet can check for
> > such an error code before reading from a URLConnection's
> > input stream?
> >
>
> In your applet, you can cast the URLConnection to an HttpURLConnection (since
> you used an "http" URL to contact the servlet). Now, you can call the
> getResponseCode() method to retrieve the HTTP status code set by the servlet.
I was thinking that (in theory, at least) one could issue a HEAD before
deciding to issue a GET. Normally, the response for a HEAD would include
error codes and save the tax that a GET might require. In that case, I was
wondering:
a) would anybody know how to issue a HEAD from URLConnection?
b) is it MANDATORY for the servlet to implement the doHead() or some
default implementation would suffice?
Am I missing something in the theory?
TIA,
Kostas
>
> Craig McClanahan
>
___________________________________________________________________________
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