在 google 引擎中,我可以获取网络上的其他 URL,但无法获取 google doc(我尝试了正常的 java url 连接,获取 google doc 没有问题)。
java.net.SocketTimeoutException:获取时超时:https ://docs.google.com/uc ....
OutputStream os = resp.getOutputStream();
URL url = new URL("https://docs.google.com/uc?id=0B-UWER27gDKlUjRkT2czVXpzNDg");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setInstanceFollowRedirects(true);
// URL url = new URL("http://www.gradsch.ohio-state.edu/Depo/ETD_Tutorial/lesson2.pdf");
System.out.println(url);
byte b[] = new byte[2048];
InputStream is = url.openStream();
int len;
while ((len=is.read(b))!=-1)
{
os.write(b, 0, len);
}