• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to save a complete webpage including images etc?

 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to write a java program to to save a complete webpage including images etc. to my local disk? How do I achieve this? If I use a URL connection, I can only save the page and not its resources like images etc.

Please help.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to parse the content, possibly modify it because of links to resources on different servers, or in paths that are not a sub folder of the web page's folder (e.g. src="../images/image.gif"). That's not a trivial job though. Regular expressions or a proper HTML parser can help you out here.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic