Connection timeout with HttpURLConnection in Groovy
I am always getting the "Error Connecting to ${url}" message? Can anyone please show me my mistake? def url = new URL("https://www.google.com") HttpURLConnection connection = (HttpURLConnection) url.openConnection() connection.setRequestMethod("GET") // connection.setConnectTimeout(10000) connection.connect() if (connection.responseCode == 200 || connection.responseCode == 201) { def returnMessage = connection.content //print out the full response println returnMessage } else { println "Error Connecting to " + url } | Error 2012-07-05 00:04:05,950 [http-bio-8080-exec-6] ERROR errors.GrailsExce
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.