Scott Neufeld wrote:

> We're trying to get an HttpURLConnection to retrieve a document on a web
> server that is ACL-protected by the listener. Is there a way to pass
> authentication information with the request?
>

You need to send an "Authorization" header along with your request, the same
way that a browser does after asking you for the username and password.  The
details of the format are in the HTTP protocol specifications, but for basic
authentication the value of this header is the word "Basic", a space, and then
the base 64 encoding of the userid+password string.  There are Base 64 encoder
utility classes around the net -- check your favorite Java source code archive
site for more.

The HTTP specs can be grabbed (among other places) at http://www.w3.org -- the
World Wide Web Consortium, which is the body that formalizes HTTP (and
HTML/XML/etc. for that matter) standards.  It is quite useful for servlet
authors to at least skim the HTTP specs once, because a servlet can do pretty
much anything allowed here; and it must (in fact) obey the rules to be
portable.

Craig McClanahan

___________________________________________________________________________
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