getContent() or getInputStream(). You don't have to call connect() explicity, as it is called when a method which requires a connection (i.e. the aformentioned methods) is invoked. You could cut out the middleman and just use url.getInputStream() if you aren't using any HTTP specific features (i.e. POST).
The Java Tutorial has a section on Input Streams. You should take a gander. Read from the InputStream, save the result to some intermediary like a StringBuffer or a StringWriter. When you are done reading, the intermediary will contain all the HTML. When you are comfortable with that, take a look at improving efficiency by using a BufferedReader.
Joined: Apr 08, 2003
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: HttpURLConnection - getting the response content