编辑:如果不能使用Retrofit 1.9,切换到较新版本(即2.0)应该自动处理以下解决方案。

看起来您的HTTP客户端(在Android端)应该通过读取当您发生这种情况时收到的响应头中的Location值来处理此重定向,该值应该包含一个目标重定向URL,您应该再次从客户端点击。

看到他们的评论here。

So for now you need to implement this at the application level (which

is hard with Retrofit 1, easier with the forthcoming Retrofit 2) or

wait until OkHttp 3.1(ish) when we implement the newest spec.

另请参阅307的含义。

Fixing 307 errors – general The 307 response from the Web server

should always include an alternative URL to which redirection should

occur. If it does, a Web browser will immediately retry the

alternative URL. So you never actually see a 307 error in a Web

browser, unless perhaps you have a corrupt redirection chain e.g. URL

A redirects to URL B which in turn redirects back to URL A. If your

client is not a Web browser, it should behave in the same way as a Web

browser i.e. immediately retry the alternative URL.

If the Web server does not return an alternative URL with the 307

response, then either the Web server sofware itself is defective or

the Webmaster has not set up the URL redirection correctly.

请参阅javadoc for Retrofit 1.9.0从响应中获取位置头值(URL);

// omitting null check for brevity

for (Header header : response.getHeaders())

{

if (header.getName().equals("Location")) {

redirectURL = header.getValue();

}

}

// do a redirect to redirectURL

java 307跳转_java – failure:retrofit.RetrofitError:307临时重定向?相关推荐

  1. java gui 跳转_java GUI点击一个按钮怎么跳转到下一个窗口

    想从登录的窗口跳转到注册的窗口,这样写点击注册为什么不跳转packageview;importjava.awt.GridLayout;importjava.awt.event.ActionEvent; ...

  2. java之跳转_java学习之五种跳转关于jsp的

    现在介绍一下五种关于jsp的跳转. 1.RequestDispatcher.forward() 是在服务器端起作用,当使用forward()时,Servlet engine传递HTTP请求从当前的Se ...

  3. java quartz 跳过_Java Quartz计划作业-禁止同时执行作业

    我正在使用Quartz Job执行特定任务. 我也在我的Main应用程序类中安排它的执行,而我试图完成的工作是不允许同时执行此作业的实例. 因此,调度程序仅应在其先前实例完成后才执行作业. 这是我的工 ...

  4. java青蛙跳井_JAVA青蛙跳井

    展开全部 先说下思路,我把距离井底的距离当做是"height",是不是第62616964757a686964616fe59b9ee7ad9431333332636435一次输入当做 ...

  5. java跳转_java servlet 几种页面跳转的方法

    Servlet: 当然,在servlet中,一般跳转都发生在doGet, doPost等方法里面. 1) redirect 方式 response.sendRedirect("/a.jsp& ...

  6. java页面跳转t赋值_java servlet 几种页面跳转的方法及传值

    java web 页面之间传值有一下这几种方式 1.form 表单传递参数 2.url地址栏传递参数 3.session 4.cookie 5.application 6.通过隐藏域传值 7.通过Ja ...

  7. java 307跳转_response.sendRedirect显示不需要的HttpStatus 302而不是307

    我有一个小测试,它应该返回带有HttpStatus Code 307的临时重定向的HttpStatus . 但它总是返回302 . @RestController @RequestMapping(va ...

  8. java过程调用语句_Java之流程控制语句

    一.Java条件语句(if...else) ifelse语法:                                              多重if语法:                 ...

  9. java后台跳转页面实现方式

    总结: java后台跳转 @Controller下return一个String类型的跳转链接 注意:如果是@RestController注解下的controller,会将返回的字符串自动包进一个req ...

最新文章

  1. linux shell if [[ ]]和[ ]区别 ||
  2. Time(sdutoj2272)_JAVA
  3. Android初级教程Activity小案例(计算器乘法运算)
  4. .net Kafka.Client多个Consumer Group对Topic消费不能完全覆盖研究总结(一)
  5. JSP语法(JSP动作)
  6. leetcode刷题六z字形变换
  7. 边工作边刷题:70天一遍leetcode: day 6
  8. 如何方便记忆和理解类图里的线条
  9. 韩顺平php视频笔记36 php基本语法
  10. java中字符数组和字符串的相互转换
  11. OpenGL基础29:深度测试
  12. 初识Python 04 day
  13. [CTSC1999] 家园
  14. 恒强系统服务器,恒强系统色码解析大全
  15. VsCode如何设置成中文
  16. Scala中的基本类型 与操作符
  17. 职场的5个时间管理技巧
  18. 好书推荐之《不能承受的生命之轻》 隐私策略(Privacy policy)
  19. win7电脑给手机开热点流程
  20. ubuntu服务器图形界面崩溃解决方案

热门文章

  1. Linux系统查看各种信息
  2. 写入和读取外部存储文件
  3. 又一次摔MFC坑里了
  4. sql limit不接具体数字_SQL汇总函数和分组函数
  5. 微课|中学生可以这样学Python(2.2.2节+2.2.5节):关系运算符和集合运算符
  6. linux 网络端口全连接扫描,端口全连接扫描程序(Linux, socket):TCP的connect方式...
  7. java file.length 单位_Java.io.File.length()返回0
  8. python情感分析预测模型_Python 使用 NLTK 实现简单情感分析--Twitter(推特)分析...
  9. 操作系统锁的实现方法有哪几种_java 偏向锁、轻量级锁及重量级锁synchronized原理...
  10. mysql 索引未命中_联合索引命中率问题导致SQL查询效率慢的问题