Web tier: servlets, JSP, Web frameworks: Include External URL content
- Posted by: Manab Sarkar
- Posted on: December 19 2003 11:57 EST
I want to include the content of a URL in my servlet. for example: i want to get the content of http://www.yahoo.com and return the HTML of yahoo.com from my servlet while the browser is unware of this.
Thanks in advance
There are lots of ways to do this. This most straightforward is to use a java.net.URL and java.net.URLConnection to download the remote page into memory, then insert it into the OutputStream of your servlet using out.print() statements.
See for example Request or HTTP taglib from Coldtags suite: