sometimes getResponseCode throw a FileNotFoundExecption, (known
bug)
so catch it , and then use getHeaderField to get "Not Found 404"...
Nicolas
De : Mads Pultz@mpultz le 22/02/2001 11:32
Pour : tomcat-user@[EMAIL PROTECTED]@SMTP@Hays Hub
cc :
Faxer à:
Objet : Reading error codes sent from servlet to applet
Hi!
First, I'm using Tomcat stand-alone with IBM JDK 1.3 on RH 6.2.
I'm developing an applet-servlet application. When I do POST
requests I want
the applet to pick up any errors from the servlet but I'm getting
IOExceptions when reading from the stream. Writing to the stream and
activating doPost() is not a problem. For example if I send a NOT
FOUND with
either sendError() or setStatus() on the stream then I cannot read
from the
stream in my applet, I get "stream closed". Is is possible for the
applet to
read these error codes or are they blocked by the browser? I have
also tried
in my applet to type cast the URLConnection to HttpURLConnection
because I
then could get the error code with getResponseCode() instead of
using
getHeaderField(), but this raises Exception as well, cannot find my
servlet.
I'm still new to servlets so I might be wrong about how to go about
error
control. Is it recommended to do error control this way with
communication
between applets and servlets? I know I can sent my error messages
with OK
but I curious about why the above doesn't work.
Any help or comments would be appreciated. Thanks.
Mads
P.S. Please reply to my e-mail address as well.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
**********************************************************************
Ce message électronique et tous les fichiers attachés qu'il contient
sont confidentiels et destinés exclusivement à l'usage de la personne
à laquelle ils sont adressés. Si vous avez reçu ce message par erreur,
merci de le retourner à son émetteur. Les idées et opinions présentées
dans ce messages sont celles de son auteur, et ne représentent pas
nécessairement celles du Groupe HAYS plc ou d'une quelconque de ses filiales.
La publication, l'usage, la distribution, l'impression ou la copie non
autorisée de ce message et des attachements qu'il contient sont strictement
interdits.
Nous vous informons également que nous avons vérifié l'absence de virus dans
ce message mais que, malgré ce contrôle, nous ne saurions être tenus pour
responsables d'éventuels dégâts occasionnés par un virus non détecté.
This e-mail and any attached files are confidential and intended
solely for the use of the individual to whom it is addressed. If you have
received this email in error please send it back to the person that sent it
to you. Any views or opinions presented are solely those of author and
do not necessarily represent those the HAYS plc group or any of its subsidiary
companies. Unauthorized publication, use, dissemination, forwarding, printing
or copying of this email and its associated attachments is strictly prohibited.
We also inform you that we have checked that this message does not contain
any virus but we decline any responsability in case of any damage caused
by an a non detected virus.
**********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]