-
reading input from UrlConnections
I am having a problem reading input from a URLConnection object.
I am using a servlet to read from a site and print the data out on my site.
My code goes like:
String urlString = "http://www.moreover.com";
URL redirectURL = new URL(urlString);
URLConnection conn = redirectURL.openConnection();
DataInputStream dIn = new DataInputStream(conn.getInputStream());
String r = dIn.readUTF();
//now print it out to the screen...
out.print(r);
However the HTML is corrupted and only a portion of what should be displayed,
is displayed. I think there is some conversion issue, although I am unable
to obtain the content encoding from the URLConnection and the ContentType
is html/text.
Any help would be greatly appreciated as this is driving me mad!
Thanks in advance,
Phil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks