试了下,还是null
@Test
public void testHeader() {
String url = "http://www.jsgsj.gov.cn:58888/province/infoQueryServlet.json?pt&c=75B161B67BE862B17AE530F7EF775C053FF98D74A4DA979B34CA5EE6C2A4A474E8E3D7F41B3E9A2C48594245350BD6F5C528B8D5CCC43FCE4A6E4436E46BBAA1";
Response resp = Sender.create(Request.get(url))
.setFollowRedirects(false).send();
Header header = resp.getHeader();
System.out.println(header.get("Location"));
}
debug:
{
"null": "HTTP/1.1 200 OK",
"Date": "Thu, 22 Dec 2016 09:14:27 GMT",
"Content-Length": "9389",
"Set-Cookie": "BIGipServerpool_gsp=3539904704.25353.0000; path=/",
"Content-Type": "text/html; charset=UTF-8",
"X-Powered-By": "Servlet/2.4 JSP/2.0",
"Cache-Control": "no-cache=\"set-cookie\""
}
为什么我不能贴图片上去?只好贴文字了,chrome里边监控到的是这样的:
connection:close
Content-Type:text/html;charset=utf-8
Date:Thu, 22 Dec 2016 07:32:37 GMT
Location:http://www.jsgsj.gov.cn:58888/ecipplatform/jiangsu.jsp?org=DBBF2B3C27C5E35AC652C56F1A7BBB21&id=F140F3790F379BA49E3D577569304F94&seqId=15549DD3C4F1EF908D7C130097703D1E&activeTabId=
Transfer-Encoding:chunked
X-Powered-By:Servlet/2.4 JSP/2.0
想获得其中的Location