http://stackoverflow.com/questions/3658721/httpclient-4-error-302-how-to-redirect

 DefaultHttpClient  httpclient = new DefaultHttpClient();
httpclient.setRedirectStrategy(new DefaultRedirectStrategy() {
public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) {
boolean isRedirect=false;
try {
isRedirect = super.isRedirected(request, response, context);
} catch (ProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (!isRedirect) {
int responseCode = response.getStatusLine().getStatusCode();
if (responseCode == 301 || responseCode == 302) {
return true;
}
}
return isRedirect;
}
});

Httpclient 4, error 302. How to redirect?的更多相关文章

  1. (原创)解决.net 下使用uploadify,在火狐浏览器下的error 302

    简单粗劣说下哈,通过uploadify中flash在火狐下上传,造成了erroe 302, 是因为其session丢失,并修改了其sessionID. 网上有很多案列,可并没有这么直接.感觉绕了点弯. ...

  2. jquery上传插件uploadify 报错http error 302 解决方法之一

    前段时间用到jquery上传插件uploadify时,始终出现系统报出 http error 302 的错误. 网上大量搜集信息,基本上都是说session值丢失的问题,根据网友提供的解决方案进行修改 ...

  3. How to create your own custom 404 error page and handle redirect in SharePoint 分类: Sharepoint 2015-07-08 00:22 4人阅读 评论(0) 收藏

    1. In your MOSS server, make a copy of %systemdrive%\Program Files\Common Files\Microsoft Shared\Web ...

  4. HttpClient如何解决302重定向问题

    最近的接口测试,发现接口地址报302错误,通过上网搜索,发现问题所在,解决办法是需要请求重定向后的URI. package com.btv; import org.apache.http.Header ...

  5. Data Flow ->> Source ->> Error Output ->> Error & Truncation: Ignore Failure, Redirect Now, Fail Component

    Ignore Failure: 当该字段遇到错误时,字段值被设为NULL Redirect Now: 把该行输出到SSIS的Source组件的红色输出线,这时红色输出线应该连接一个可以接受结果集的组件 ...

  6. uploadify 火狐 http error:302

    网上查询了一都说是flash 中 Session问题 (IE会自动复制过去),大多说将session值传过去就可以了但我们用的是公司的一套权限,改不了用户登录信息 无奈只好不用用户信息来做,果然对了 ...

  7. 关于ThinkPHP下使用Uploadify插件 仅有火狐提示HTTP Error (302)错误的解决办法

    'VAR_SESSION_ID' => 'session_id', //修复uploadify插件无法传递session_id的bug 首先在项目目录中的Common/Conf/config.p ...

  8. Data Flow的Error Output

    一,在Data Flow Task中,对于Error Row的处理通过Error Output Tab配置的. 1,操作失败的类型:Error(Conversion) 和 Truncation. 2, ...

  9. http 302

    404 not found500 internal server error 302临时重定向.指被访问的网页由于各种需求临时跳转到其它页面. yii若用户为游客状态,但controller中添加了权 ...

随机推荐

  1. leetcode660. Remove 9

    leetcode660. Remove 9 题意: 从整数1开始,删除任何包含9的整数,如9,19,29 ... 所以现在,你将有一个新的整数序列:1,2,3,4,5,6,7,8,10,11,... ...

  2. PHP self与static区别

    this,static和self. self和this还是很好区分的,可是self和static就很糊涂了,两者都能调用静态的方法和属性,看似使用上没有什么太大的分别,但是实际上分别很大,先来看下面这 ...

  3. what is a process?

    A process is a program in execution. A process is more than the program code, which is sometimes kno ...

  4. android手机安全:被攻陷的一个场景

     到处找WIFI,对于我们的手机控来说是相当普遍的了.假设你发现了有可用的wifi,并选择了浏览器连接,当浏览器出现一个web 页面的时候,你可能已经中招了. 相同,当你的手机使用一些免费应用的时候, ...

  5. druid连接数据库加解密

    <bean id="dataSource" class="cn.zsmy.palmdoctor.utils.DecryptDruidSource" ini ...

  6. HTTP 协议中 Vary 的一些研究

    经常抓包看 HTTP 请求的同学应该对 Vary 这个响应头字段并不陌生,它有什么用?用 PageSpeed 工具检查页面时,经常看到「Specify a Vary: Accept-Encoding ...

  7. RobotFramework自动化2-自定义关键字

    前言 有时候一个页面上有多个对象需要操作,如果一个个去定位的话,比较繁琐,这时候就可以定位一组对象.Selenium2library提供了Get Webelements 关键字,用于定位一组元素 以百 ...

  8. Spring3数据库事务管理机制

    Spring对事务的解决办法其实分为2种:编程式实现事务,AOP配置声明式解决方案. http://jinnianshilongnian.iteye.com/blog/1496953 Spring提供 ...

  9. 一道面试题:用shell写一个从1加到100的程序

    [试题描述] 请用shell写一个简短的程序,实现1+2+...+100的功能. [程序] 方法一: #!/bin/bash ..} do let sum+=$i done echo $sum 方法二 ...

  10. java.lang.ClassNotFoundException: Didn&#39;t find class &quot;stu.love.neihan.MainActivity&quot; on path: DexPathL

    java.lang.ClassNotFoundException: Didn't find class "stu.love.neihan.MainActivity" on path ...