-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

> I meant to say
>
> res.setHeader("WWW-Authenticate", BASIC "\"realmname\"");
> res.sendError(res.SC_UNAUTHORIZED);

or as per the spec:

res.setHeader("WWW-Authenticate", "BASIC realm="\realmname\"");
res.sendError(res.SC_UNAUTHORIZED);

Though yours works on my machines without the realm=


I have a similar setup (but Apache 1.3.6) and it works as expected with a test servlet 
below. This also works with Apache 1.3.9 on
my windows 95 machine.


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class AuthTest extends HttpServlet {

        public void doGet(HttpServletRequest req, HttpServletResponse res)
                                        throws ServletException, IOException {

                res.setContentType("text/plain");
                PrintWriter out = res.getWriter();

                String auth = req.getHeader("Authorization");

                if (auth == null) {
                        res.setHeader("WWW-Authenticate", "BASIC 
realm=\"ImportantStuff\"");
                        res.sendError(res.SC_UNAUTHORIZED);
                }
                else
                        out.println("Secret Stuff for: " + auth);

        }
}

HTH

***********************************************************
Brett Knights                             626-432-5767 work
[EMAIL PROTECTED]                 626-355-1017 home
***********************************************************





--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to