org.apache.http.client.CircularRedirectException: Circular redirect to "http://xxx"问题解决
org.apache.http.client.CircularRedirectException: Circular redirect to...
解决方法如下:
HttpParams params = new BasicHttpParams(); getMethod.getParams().setParameter("http.protocol.allow-circular-redirects", true);HttpResponse response = httpClient.execute(getMethod);参考了:http://z1y1m1.blog.163.com/blog/static/518373272013626778409/
另外记录下相关参数说明:
这些是可以用于定制默认HttpClient实现行为的参数:
'http.protocol.handle-redirects':定义了重定向是否应该自动处理。这个参数期望得到一个Java.lang.Boolean类型的值。如果这个参数没有被设置,HttpClient将会自动处理重定向。
'http.protocol.reject-relative-redirect':定义了是否相对的重定向应该被拒绝。HTTP规范需要位置值是一个绝对URI。这个参数期望得到一个java.lang.Boolean类型的值。如果这个参数没有被设置,那么就允许相对重定向。
'http.protocol.max-redirects':定义了要遵循重定向的最大数量。这个重定向数字的限制意在防止由破碎的服务器端脚本引发的死循环。这个参数期望得到一个java.lang.Integer类型的值。如果这个参数没有被设置,那么只允许不多余100次重定向。
'http.protocol.allow-circular-redirects':定义环形重定向(重定向到相同路径)是否被允许。HTTP规范在环形重定向没有足够清晰的允许表述,因此这作为可选的是可以开启的。这个参数期望得到一个java.lang.Boolean类型的值。如果这个参数没有被设置,那么环形重定向就不允许。
'http.connection-manager.factory-class-name':定义了默认的ClientConnectionManager实现的类型。这个参数期望得到一个java.lang.String类型的值。如果这个参数没有被设置,对于每个默认的将使用SingleClientConnManager。
'http.virtual-host':定义了在头部信息Host中使用的虚拟主机名称,来代替物理主机名称。这个参数期望得到一个HttpHost类型的值。如果这个参数没有被设置,那么将会使用目标主机的名称或IP地址。
'http.default-headers':定义了每次请求默认发送的头部信息。这个参数期望得到一个包含Header对象的java.util.Collection类型值。
'http.default-host':定义了默认主机。如果目标主机没有在请求URI(相对URI)中明确指定,那么就使用默认值。这个参数期望得到一个HttpHost类型的值。
org.apache.http.client.CircularRedirectException: Circular redirect to "http://xxx"问题解决的更多相关文章
- org.apache.http.client.HttpClient; HttpClient 4.3超时设置
可用的code import org.apache.commons.lang.StringUtils;import org.apache.http.HttpEntity;import org.apac ...
- apache.http.client.HttpClient
前言 HTTP 协议可能是现在 Internet 上使用得最多.最重要的协议了,越来越多的 Java 应用程序需要直接通过 HTTP 协议来访问网络资源.虽然在 JDK 的 java net包中已经提 ...
- Apache HttpComponents Client 4.0快速入门/升级-2.POST方法访问网页
Apache HttpComponents Client 4.0已经发布多时,httpclient项目从commons子项目挪到了HttpComponents子项目下,httpclient3.1和 h ...
- apache AH01630: client denied by server configuration错误解决方法
今天本来是想要在自己本地搭建一个wamp环境用来做一些代码的测试和框架的学习. 鉴于目前工作的时候用到了php5.5,所以就用了wamp-server V2.5版本,安装完成之后配置虚拟主机一直出现4 ...
- org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Internal Server Error 错误
Solr报错: { "responseHeader": { "status": 500, "QTime": 11 }, "erro ...
- JAVA中使用Apache HttpComponents Client的进行GET/POST请求使用案例
一.简述需求 平时我们需要在JAVA中进行GET.POST.PUT.DELETE等请求时,使用第三方jar包会比较简单.常用的工具包有: 1.https://github.com/kevinsawic ...
- org.apache.http.client.methods.HttpGet 转到定义找不到源代码
例如 org.apache.http.client.methods.HttpGet ,提示没有源码 到这里下载 http://hc.apache.org/downloads.cgi Source 4. ...
- java.lang.NoClassDefFoundError: org/apache/http/client/config/RequestConfig
java 错误.java.lang.NoClassDefFoundError: org/apache/http/client/config/RequestConfig 本质上是httpClient的j ...
- org.apache.commons.httpclient和org.apache.http.client区别(转)
官网说明: http://hc.apache.org/httpclient-3.x/ Commons HttpClient项目现已结束,不再开发.它已被其HttpClient和HttpCore模块中的 ...
随机推荐
- c sharp学习 问题记录
1.函数的调用可以嵌套,定义不可以 C# 参考之方法参数关键字:params.ref及out C#中方法的参数的四种类型
- [转]Using the Group Pane to Repeat Page Titles
转自:http://www.wiseowl.co.uk/blog/s148/group-pane-advanced-mode.htm Repeating Page Headers in Reporti ...
- xcode4.3 完成输入后 点击背景关闭键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES];} 把这个复制到 ...
- miniUI 可编辑datagrid获取值的问题
<div id="variableGrid" class="mini-datagrid" borderStyle="border-right:0 ...
- http://www.bejson.com/go.html?u=http://www.bejson.com/demo2.html
json 解析工具http://www.bejson.com/go.html?u=http://www.bejson.com/demo2.html
- Ramsey theorem in Combinarotics
- ..在lua中运用
..连接两个字符串 th> a="hello" th> b="world" th> print(a..b) helloworld th> ...
- acdream 1148 GCD SUM 莫比乌斯反演 ansx,ansy
GCD SUM Time Limit: 8000/4000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatis ...
- php基础复习(3)文件上传于下载
一. 客户端配置: 表单页面 表单的发送方式是post 添加enctype = “multipart/form-data” <form action="doaction.php&q ...
- Repeater的Command操作
Repeater的Command操作 1.ItemCommand事件 :在Repeater中所有能触发事件的控件,都会来触发这一个事件 后台创建:在Page_Load中 Repeater1.ItemC ...