JAVA 2011-01-06 16:43 JAVA API , 。 :
URL url = new URL(myurl);
BufferedReader br = new BufferedReader(newInputStreamReader(url.openStream()));
String s = "";
StringBuffer sb = new StringBuffer("");
while ((s = br.readLine()) != null) {
i++;
sb.append(s+"\r
");
}
, redirect , Server redirected too many times , , 。 URL , , 。
URL urlmy = new URL(myurl);
HttpURLConnection con = (HttpURLConnection) urlmy.openConnection();
con.setFollowRedirects(true);
con.setInstanceFollowRedirects(false);
con.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"UTF-8"));
String s = "";
StringBuffer sb = new StringBuffer("");
while ((s = br.readLine()) != null) {
sb.append(s+"\r
");
}
, , 。
, , Java , 。
System.getProperties().setProperty( "http.proxyHost", proxyName );
System.getProperties().setProperty( "http.proxyPort", port );
。
sb , , , , , !