我一直在尝试处理
java代码中的重定向(302)……以及我使用的代码
org.apache.commons.httpclient.HttpClient没有声明setRedirectStrategy(),所以我必须编写自己的重定向实现:
private void loadHttp302Request(HttpMethod method, HttpClient client,
int status, String urlString) throws HttpException, IOException {
if (status!=302)
return;
String[] url = urlString.split("/");
logger.debug("Method -> loadHttp302Request -> Location : " + method.getResponseHeader("Location")
.getValue());
logger.debug("Method -> loadHttp302Request -> Cookies : " + method.getResponseHeader("Set-Cookie")
.getValue());
logger.debug("Method -> loadHttp302Request -> Referrer : " + url[0]+"//"+url[2]);
HttpMethod theMethod = new GetMethod(urlString+method.getResponseHeader("Location")
<