views:

95

answers:

3

hi.i am a new bie to java.i had a problem i need to save a complete webpage(with all its contents like images,css,javascript e.t.c) like how we can do with save as-->complete webpage option with HttpClient lib.plese show me a way how to do this.

A: 

You can try lib curl java http://curl.haxx.se/libcurl/java/

And you can refer to this discussion also curl-equivalent-in-java

Gerard Banasig
A: 

You have to write an application that fetches the html file, parses it and extracts all the references, and then fetches all the files found by parsing.

Ralph Stevens
A: 

It's not so easy because some CSS/JS/Images files paths might be "hidden". Just consider the following example:

<script type="...">
   document.write("&bla;script" + " type='...' src='" + blahBlah() + "'&bla;" + "&bla;/script&bla;");
</script>

However, fetching page source, parsing in the search for URLs and downloading founded URLs is pretty everything you'll probably need.

Crozin