aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes How to save a complete webpage including images etc? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How to save a complete webpage including images etc?" Watch "How to save a complete webpage including images etc?" New topic
Author

How to save a complete webpage including images etc?

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
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.


Thanks and Regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to save a complete webpage including images etc?