You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Paul Jolin <PW...@cvs.com> on 1999/02/04 22:36:48 UTC

config/3836: sendError(int sc, String msg) unsupported.

>Number:         3836
>Category:       config
>Synopsis:       sendError(int sc, String msg) unsupported.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Feb  4 13:40:01 PST 1999
>Last-Modified:
>Originator:     PWJolin@cvs.com
>Organization:
apache
>Release:        1.3.4 and JServ release 1.0b2
>Environment:
UnixWare cvs7 5 7.0.1 i386 x86at SCO UNIX_SVR5
>Description:
The following JSDK 2.0 standard method for javax.servlet.http.HttpServletResponse is unsupported by Apache JServ 1.0b2:

public abstract void sendError(int sc, String msg) throws IOException

Sends an error response to the client using the specified status code and descriptive message. If setStatus has previously been called, it is reset to the error status code. The message is sent as the body of an HTML page, which is returned to the user to describe the problem. The page is sent with a default HTML header; the message is enclosed in simple body tags (<body></body>). 

Parameters: 
    sc - the status code 
    msg - the detail message 
Throws: IOException 
    If an I/O error has occurred. 
[ NOTE: Apache directive in use: ErrorDocument 500 /internal_error.html ]
--------------------- internal_error.html source ------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>
500 Internal Server Error
</TITLE>
</HEAD>
<STYLE TYPE="text/css">
    H1 { font-size: x-large; color: black }
</STYLE>

<BODY>
<B>
<H1>500 Internal Server Error</H1>
</B>
</BODY>
</HTML>
----------------- end internal_error.html source ------------------------
>How-To-Repeat:
Add the following to a servlet:
:
:
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws
		ServletException, IOException
{
:
:
:
resp.sendError(resp.SC_INTERNAL_SERVER_ERROR, "Application additional message text...");
:
:
:
}
>Fix:
Implement the JSDK 2.0 standard for sendErrorMessage(int sc,String msg) which will Send an error response to the client using the specified status code and a default message. 
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]