This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

External WebpAge rendering

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
}
%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic