For an http GET I didn't need to call setRequestMethod or cast to
HttpURLConnection

String response = null;
int timeoutmili = 5000;
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
conn.setConnectTimeout(timeoutmili);
conn.setReadTimeout(timeoutmili);
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
    sb.append(line);
}
response = sb.toString();


On Oct 26, 6:56 pm, Bourke Floyd IV <[email protected]> wrote:
> URL authUrl = new URL(url);
> connection = (HttpURLConnection) authUrl.openConnection();
> connection.setRequestMethod("GET"); //<- already connected exception.
>
> The documentation indicates that I supposed to use openConnection,
> then set my params, then use connect.
>
> Inspecting the connection object in the debugger indicates that
> connection is already connected before the setRequestMethod is called,
> dispite the fact that I haven't called connect yet. Also, I'm not
> calling any other functions. This is my code, not an example. This is
> also inside of my HttpServlet doGet override

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to