Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Site Authorization using HttpClient: cannot receive cookie.  RSS feed

Dmitry Zhuravlev
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!