This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Not positive this is the right forum but here it goes.
Does anyone have a good tutorial for accessing a web page via Java code where the page is secured with standard Java 2 security by the web server? Ideally I'd like to use Apache HttpClient to do so but haven't been able to find any good examples.
What do you mean by "secured with standard Java 2 security"? The only security that would be applicable to a web app would be to use HTTP Authentication (and possibly using HTTPS, which doesn't have much to do with Java). HttpClient can handle HTTP Authentication.
Joined: Sep 12, 2005
Sorry for the confusion.
I'm thinking about the j_username/j_password user auth functionality that most web servers offer. How would I go about passing the auth values in a request to the server?
Joined: Mar 22, 2005
Ah, that's called FORM authentication, and is a little harder to automate. The code would access some URL that is protected, which would then cause the login page to be shown. Into that page (or rather, the HTML form in it) would the code enter appropriate values for j_username and j_password, and then submit it. If everything went OK, the server would then respond with the page that was originally requested. This discussion may help.