HttpPost -> Redirect -> Location or body of response needed

五迷三道 提交于 2019-12-01 12:21:36
Oliver Goossens

I have found the problem!

httpclient.getParams().setParameter("http.protocol.version",
                HttpVersion.HTTP_1_0);

Just changing this one line - version 1_0 works and 1_1 does not. Don't ask me why :)

Thank you all!

Wallywl

Please try the following code. The location in the header is missing, because the page has already redirected. So we can disable redirection to get the location tag.

httpclient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, false);

Try calling this after you create your http client so that it follows your redirect

httpclient.getParams().setParameter("http.protocol.allow-circular-redirects", true);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!