users@jsr311.java.net

Re: JSR311 Response and corresponding message

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 09 Sep 2008 09:43:43 -0400

Seems like this is an area of "interpretation" in Servlet, I'll notify
the servlet 3.0 spec lead of the confusion. I note that the setStatus
method was deprecated and the reason given sounds similar.

Marc.

On Sep 9, 2008, at 9:38 AM, Paul Sandoz wrote:
>
> On Sep 9, 2008, at 3:24 PM, Marc Hadley wrote:
>
>> On Sep 9, 2008, at 6:08 AM, Paul Sandoz wrote:
>>>>
>>>> I just noticed that the sendError(int sc,String msg) method can
>>>> customize an error code.
>>>> It means that it is possible to have a header like that:
>>>> HTTP/1.1 404 My custom message
>>>>
>>>
>>> You are right. I just checked with a simple servlet implementation
>>> and the "msg" parameter does indeed correspond to the reason
>>> phrase on the status line.
>>>
>>> Drat! that is an oversight on our part.
>>>
>> That is incorrect behavior according to the Javadoc which says:
>
>> "Sends an error response to the client using the specified status.
>> The server defaults to creating the response to look like an HTML-
>> formatted server error page containing the specified message,
>> setting the content type to "text/html", leaving cookies and other
>> headers unmodified. If an error-page declaration has been made for
>> the web application corresponding to the status code passed in, it
>> will be served back in preference to the suggested msg parameter."
>>
>> I.e. the msg goes in the body, not the reason phrase.
>>
>
> Phew!
>
> I double checked with the Servlet implementation in GF, it does
> both, namely puts the message in the status line and embedded in
> some HTML as a response entity. So this means you can put a really
> long message in the status line, but it strips out \r\n :-)
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.