From f81087686bb135608be80824242aa143ab3d1d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=B0=E5=B9=B3=E7=BA=BF?= <22250530@qq.com> Date: Wed, 17 Jun 2015 09:53:23 +0800 Subject: [PATCH] --- src/com/wentch/redkale/util/Utility.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/wentch/redkale/util/Utility.java b/src/com/wentch/redkale/util/Utility.java index 93a4b0c67..82e7883f3 100644 --- a/src/com/wentch/redkale/util/Utility.java +++ b/src/com/wentch/redkale/util/Utility.java @@ -385,6 +385,12 @@ public final class Utility { conn.getOutputStream().write(body.getBytes(UTF_8)); } conn.connect(); + int rs = conn.getResponseCode(); + if (rs == 301 || rs == 302) { + String newurl = conn.getHeaderField("Location"); + conn.disconnect(); + return remoteHttpContent(ctx, method, newurl, body); + } InputStream in = conn.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(1024); byte[] bytes = new byte[1024];