It's not a secret anymore!*
The moose likes Sockets and Internet Protocols and the fly likes Site Authorization using HttpClient: cannot receive cookie. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Site Authorization using HttpClient: cannot receive cookie." Watch "Site Authorization using HttpClient: cannot receive cookie." New topic
Author

Site Authorization using HttpClient: cannot receive cookie.

Dmitry Zhuravlev
Ranch Hand

Joined: Apr 14, 2010
Posts: 91
Hello Gentlemen!

Need help with the ApacheHTTPClient framework.

I want to connect to my web-site which uses a standart java form authentication. I use ApacheHttpClient 4 and track the HTTP requests with the help of WireShark utility. At the moment my HTTP POST requests to authorization form are almost coinside with the requests sent by browser except for the order of the headers. But unfortunately I cannot login to the site. I dont know why.
As you know, the login procedure is the following: site creates a cookie when I reach the login page, and after I POST the credentials it sends me another cookie or modifies the existing. If I login to my site with the help of browser it modifies the cookie I accepted when first reached the login page. But when I try to POST the login form with my client - the modification of the cookie do not happens and I cannot log in into the protected section.

Where I went wrong?

Here is the code of my client taken from Apache HttpClient tutorials:



Any suggestions?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Site Authorization using HttpClient: cannot receive cookie.
 
Similar Threads
How to return a parameter from a servlet to the calling HttpClient
Manipulating static web pages to get dynamic results!
Logging in with HttpClient from Apache
HttpClient issue on Https Connection (multiple post)
unable to login to a website. tried both httpclient and defaulthttpclient