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
htmlheadtitleApache Tomcat/4.0.3 - Error
report/titleSTYLE!--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
/headbodyh1Apache Tomcat/4.0.3 - HTTP Status
401
- Unauthorized/h1HR size=1
noshadepbtype/b
Status report/ppbmessage/b
uUnauthorized/u/ppbdescription/b
uThis
request requires HTTP authentication
(Unauthorized)./u/pHR size=1
noshade/body/htmlConnection 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]