This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Authentication via HttpUrlConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Authentication via HttpUrlConnection" Watch "Authentication via HttpUrlConnection" New topic

Authentication via HttpUrlConnection

Bill Siggelkow
Ranch Hand

Joined: Jun 27, 2001
Posts: 57
Has anyone successfully used the Authenticator class? I tried this from a client app and it did not seem to work. Instead, I simply stored the username and password as base64 encoded strings in the request. I am connecting to a servlet running on WLS 6.1.

Bill Siggelkow
Jade Cove Solutions
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
The Authenticator class (I assume you are using the one from OReilly) encodes the Authentication information in the http request header. The Server or Servlet has to be configured to accept the authentication in this manner. If when you connect using a browser, a popup window is displayed for username and password, you can be fairly sure it's configured that way. If you want information on writing a servlet that reads the Basic Authentication from a http request header, I recommend you post the question in Serlvet forum.
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
It is sorta covered in the JavaRanch Style Guide.
subject: Authentication via HttpUrlConnection
Similar Threads
Cant use object from another class
WA #1.....word association
Posting to bump up my count...
Text box value is not being completely filled with request attribute
The x900 effect ?