You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ying lcs <yi...@gmail.com> on 2007/09/06 07:28:39 UTC

Setting SC_INTERNAL_SERVER_ERROR in http servlet response

Hi,

In my servlet, I set the response code to 500, like this:

response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);


Why tomcat attached this in my http response? And how can I disable it?

Thank you.

<html><head><title>Apache Tomcat/4.1.36 - Error
report</title><STYLE><!--H1{font-family :
sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}
H3{font-family : sans-serif,Arial,Tahoma;color :
white;background-color : #0086b2;} BODY{font-family :
sans-serif,Arial,Tahoma;color : black;background-color : white;}
B{color : white;background-color : #0086b2;} HR{color : #0086b2;}
--></STYLE> </head><body><h1>HTTP Status 500 - </h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u></u></p><p><b>description</b> <u>The server encountered an internal
error () that prevented it from fulfilling this request.</u></p><HR
size="1" noshade="noshade"><h3>Apache Tomcat/4.1.36</h3></body></html>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Setting SC_INTERNAL_SERVER_ERROR in http servlet response

Posted by Len Popp <le...@gmail.com>.
When a web server returns an error status, it's supposed to include an
HTML page with an error message. The one you're seeing is Tomcat's
default error page. You can customize the error page by putting an
<error-page> declaration in your application's web.xml file.
-- 
Len

On 9/6/07, ying lcs <yi...@gmail.com> wrote:
> Hi,
>
> In my servlet, I set the response code to 500, like this:
>
> response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
>
>
> Why tomcat attached this in my http response? And how can I disable it?
>
> Thank you.
>
> <html><head><title>Apache Tomcat/4.1.36 - Error
> report</title><STYLE><!--H1{font-family :
> sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}
> H3{font-family : sans-serif,Arial,Tahoma;color :
> white;background-color : #0086b2;} BODY{font-family :
> sans-serif,Arial,Tahoma;color : black;background-color : white;}
> B{color : white;background-color : #0086b2;} HR{color : #0086b2;}
> --></STYLE> </head><body><h1>HTTP Status 500 - </h1><HR size="1"
> noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
> <u></u></p><p><b>description</b> <u>The server encountered an internal
> error () that prevented it from fulfilling this request.</u></p><HR
> size="1" noshade="noshade"><h3>Apache Tomcat/4.1.36</h3></body></html>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org