I'd like some clarification of the way container
implementations are intended to interpret the msg
argument of the,

  HttpServletResponse.sendError(int sc, String msg)

method.

According to the 2.2 spec,

  An optional String argument can be provided to the
  sendError method which can be used in the content
  body of the error.

According to the 2.2 javadoc,

  Sends an error response to the client using the
  specified status code and descriptive message. The
  server generally creates the response to look like a
  normal server error page.

According to the 2.1 javadoc,

  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>).

In addition, I have had experience of implementations
which simply send the msg argument as the complete
response entity without any additional boilerplate.

The specs wording needs to be tightened up here. If the
intent is that the msg argument be usable as an
insertion into a piece of boilerplate, then there needs
to be language specifying what the DOCTYPE of the
enclosing message is (ie. is it HTML 3.2, 4.0, XHTML
1.0, XML 1.0?) and what the enclosing element is
(<BODY>, <P>, <DIV>?) otherwise it will be difficult for
a container to make any guarantees that the resulting
entity is valid (or even well-formed).

This could be a source of interoperability problems (ie.
in one container a servlet produces valid error
responses, in another, the same servlet produces invalid
error responses).

Given that in the not too distant future servlet
implementors might want to generate XHTML/XML error
responses, it might be better to simply deprecate this
method and have them generate error responses explicitly
in the same way as normal responses.

Cheers,


Miles

--
Miles Sabin                          Cromwell Media
Internet Systems Architect           5/6 Glenthorne Mews
+44 (0)181 410 2230                  London, W6 0LJ
[EMAIL PROTECTED]           England

___________________________________________________________________________
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