|
URL url=new URL("http://www.javathinker.net");
HttpURLConnection.setFollowRedirects(true); //允许重定向
URLConnection connection=url.openConnection();
connection.setConnectTimeout(60000); //超时时间为60秒
connection.setReadTimeout(60000);
Map<String,List<String>> headers=connection.getHeaderFields();
Set<String> keySet=headers.keySet();
for(String key:keySet){ //遍历头部的所有信息
//同一项会有多一个值,此处仅显示第一个值
System.out.println(key+":"+headers.get(key).get(0)); //
}
String location=connection.getHeaderField("Location"); //读取特定的项 |
程序猿的技术大观园:www.javathinker.net
|
网站系统异常
系统异常信息 |
Request URL:
http://www.javathinker.net/WEB-INF/lybbs/jsp/topic.jsp?postID=1378&pages=31
java.lang.NullPointerException
如果你不知道错误发生的原因,请把上面完整的信息提交给本站管理人员。
|
|