Looks like you're right.

Thanks,
Mike

>From: Kevin Seguin
>Subject: RE: servlet authentication
>Date: Tue, 02 Jul 2002 02:39:06 -0700
>
>i could be wrong, but i think once you call
sendError(), the response is committed and
>you cannot set any more headers.  try reversing the
order of the
>sendError()/setHeader() calls:
>
> response.setHeader("WWW-Authenticate", "BASIC
realm=\"test\"");
> response.sendError(response.SC_UNAUTHORIZED);
>
>> -----Original Message-----
>> From: Michael Bergknoff [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, July 01, 2002 9:02 PM
>> To: [EMAIL PROTECTED]
>> Subject: servlet authentication
>>
>>
>> To test servlet-based authentication, I have a two
>> line servlet.
>>        
response.sendError(response.SC_UNAUTHORIZED);
>>         response.setHeader("WWW-Authenticate",
"BASIC
>> realm=\"test\"");
>>
>> Here is the output I get:
>> $ telnet localhost 8080
>> Trying 127.0.0.1...
>> Connected to localhost.
>> Escape character is '^]'.
>> GET /myapp/servlet
>> <html><head><title>Apache Tomcat/4.0.3 - Error
>> report</title><STYLE><!--H1{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>Apache Tomcat/4.0.3 - HTTP Status
401
>> - Unauthorized</h1><HR size="1"
noshade><p><b>type</b>
>> Status report</p><p><b>message</b>
>> <u>Unauthorized</u></p><p><b>description</b>
<u>This
>> request requires HTTP authentication>>
(Unauthorized).</u></p><HR size="1"
>> noshade></body></html>Connection closed by foreign
>> host.
>>
>> The output contains no HTTP headers, just some
Tomcat
>> generated HTML. Is this a bug in my servlet test or
>> what?
>>
>> Thanks,
>> Mike





__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to