tag:blogger.com,1999:blog-2830893467260253284.post5137694535235281535..comments2023-03-25T06:44:30.751-04:00Comments on G Dimension: HttpClient for Form Based AuthenticationGingerhttp://www.blogger.com/profile/02390294583995515442noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-2830893467260253284.post-19642087106852209882009-04-30T20:52:00.000-04:002009-04-30T20:52:00.000-04:00The 2nd post should send to j_security_check logic...The 2nd post should send to j_security_check logical name rather than login.htmlGingerhttps://www.blogger.com/profile/02390294583995515442noreply@blogger.comtag:blogger.com,1999:blog-2830893467260253284.post-18625231737148285622008-01-04T10:07:00.000-05:002008-01-04T10:07:00.000-05:00After your code executes the line:status = client....After your code executes the line:<BR/>status = client.executeMethod(authPost);<BR/><BR/>What is the value of status? Is the value 200 or 302?Anonymoushttps://www.blogger.com/profile/00713835659264193832noreply@blogger.comtag:blogger.com,1999:blog-2830893467260253284.post-58884444380333298352007-10-18T08:26:00.000-04:002007-10-18T08:26:00.000-04:00My application consist of resource which is protec...My application consist of resource which is protected by Form Authentication, Ive tried above mentioned steps to get the protected resource, <BR/>i was unable to login through Login Form, the response which i am getting after third step is the source Form login itself instead of actual resource.<BR/>Below is the snippet of my code , can any body tell me where i am going wrong.<BR/><BR/><BR/> GetMethod method = new GetMethod("http://host:port/test.html"); <BR/> int statuscode = client.executeMethod(method);<BR/> method.releaseConnection();<BR/> <BR/> <BR/> PostMethod authPost = new PostMethod("http://host:port/login.html");<BR/> // authPost.setFollowRedirects(false);<BR/> NameValuePair[] data = {<BR/> new NameValuePair("login", "user"), new NameValuePair("password", "welcome") }; authPost.setRequestBody(data); status = client.executeMethod(authPost); authPost.releaseConnection();<BR/><BR/> method = new GetMethod("http://host:port/test.html");<BR/> client.executeMethod(method);<BR/> String response = method.getResponseBodyAsString(); method.releaseConnection(); System.out.println(response);Endless Originhttps://www.blogger.com/profile/04672352577786821565noreply@blogger.com