I think I figured it out. While I was debugging I would break before
the disconnect was called in my finally block, then resend a new
request (thus the connection was already connected). Being able to Set
the RequestMethod is important to me, despite the fact that get is the
default.


On Oct 26, 7:47 pm, Nick <[email protected]> wrote:
> 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