1

I am trying to programmatically authenticate a url and get the response using Apache Commons httpclient. The response code is 200 however the i am getting a response with the a sign on page. I want to deep dive in to the sign on page and get the response.

I am noticing that the cookies are blank when i try printing using the following code: Cookie[] cookies = httpclient.getState().getCookies();

The response has the following message: "Your browser does not have JavaScript enabled. This feature is needed to support XXXX's Windows Single Sign-On (WSSO). Please contact your PC support person or call"

Pls help.

4

1 回答 1

0

确保设置以下 cookie 策略:

httpClient.getParams().setParameter("http.protocol.cookie-policy", CookiePolicy.BROWSER_COMPATIBILITY);

来自链接http://hc.apache.org/httpcomponents-client-ga/tutorial/html/statemgmt.html 浏览器兼容性:此实现力求密切模仿常见 Web 浏览器应用程序(如 Microsoft Internet Explorer)的(错误)行为和 Mozilla FireFox。

于 2013-03-23T07:58:54.233 回答