I use the following lines to get a web page from GAE, but it takes a long time, how to raise the timeout limit ?
try
{
URL url=new URL(Url + "?r=" + System.currentTimeMillis());
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
while ((line=reader.readLine())!=null) { Result += line + "\n"; }
reader.close();
}
catch (MalformedURLException e) { ... }
catch (IOException e) { ... }
GAE/J offers two APIs:
Option 1. The java.net API, where you can use the
URLConnection(or HttpURLConnection) class:Option 2. The GAE Low Level API offers a
FetchOptions#setDeadlinemethod to set the deadline for the fetch request.As a third alternative, you could also use a specific library such as HttpClient, but you would have to check if that library works with the inherent limitations of GAE/J.