File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Viewing HTML source problem.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Viewing HTML source problem.." Watch "Viewing HTML source problem.." New topic
Author

Viewing HTML source problem..

harish raghavan
Greenhorn

Joined: Jan 18, 2006
Posts: 8
Hello people...i have a doubt...i have done a program on storing the HTML source of a webpage...my system uses Direct IP and i got the output...but when i execute in LAN i get the exception Source genration error...i found the problem is due to proxy connection...can u ppl let me know how to setup proxy and make this code work...please modify this code and send me so that it works on a LAN environment...ASAP please

public int source(String linkpass)
{
StringBuffer strBuf = new StringBuffer();
URL page;
InputStreamReader in;
BufferedReader data;
String line;
URLConnection conn = null;
try
{
page = new URL(linkpass);
conn = page.openConnection();
conn.connect();
in = new InputStreamReader(conn.getInputStream());
data = new BufferedReader(in);
while ((line = data.readLine()) != null)
strBuf.append(line + "\n");
}
catch(Exception e)
{
System.out.println("Source generation error");
}
}


Code in Binaries...
 
 
subject: Viewing HTML source problem..
 
Similar Threads
string getting converted to ASCII
HTTPS over JSSE
Connections in static methods?
problem with URLConnection
Premature EOF while reading from Inputstream