This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes External WebpAge rendering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "External WebpAge rendering" Watch "External WebpAge rendering" New topic
Author

External WebpAge rendering

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
I would like to display an external webpage via a jsp. The problem is that I am behind a firewall and dont know how to do it.
<%
URL url = new URL("http://www.yahoo.com");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "application/octet-stream");
InputStream inp = conn.getInputStream();

char thisChar;

BufferedInputStream theHTML = new BufferedInputStream(inp);
DataInputStream dis = new DataInputStream(theHTML);

String theFile=null;


try
{
while ( (theFile=dis.readLine())!=null)
{
//System.out.println("theFile");
out.print(theFile);
}
dis.close();
//break;
}
catch (IOException E)
{
dis.close();
//break;
}
%>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: External WebpAge rendering
 
Similar Threads
Fastest File Read Method
Reading Data from a file and extracting the data
How to propogate Configuration changes to different servers
I/O BufferedInputStream
how exactly can i make out if a file in linux has just been updated or has been replaced.