因为工作需要,想研究一下execute执行的逻辑。
在这一行调用execute:
Apache httpclient的execute方法调试 getHttpClient的实现:
Apache httpclient的execute方法调试 我在代码里声明的HttpClient只是一个接口,
Apache httpclient的execute方法调试 实现类是InternalHttpClient。
Apache httpclient的execute方法调试 首先根据传入的请求决定出目标-target host
Apache httpclient的execute方法调试 投递到RedirectExec执行。
Apache httpclient的execute方法调试 后者又投递到RetryExec执行。
Apache httpclient的execute方法调试 收到307重定向:
Apache httpclient的execute方法调试 redirectsEnabled标志位为true:
Apache httpclient的execute方法调试 再看当前的请求确实被redirect了吗?
Apache httpclient的execute方法调试 original url:
Apache httpclient的execute方法调试 我的后台服务器返回的307,落到了分支HttpStatus.SC_TEMPORARY_REDIRECT处:
Apache httpclient的execute方法调试 看来Apache的库认为只有HEAD和GET才能被redirect:
Apache httpclient的execute方法调试 重定向最大次数:50
Apache httpclient的execute方法调试 准备重试了:
Apache httpclient的execute方法调试