使用JSoup生成本地HTML
实现功能:
1.根据URL抓取网页
2.添加(修改)网页内容
3.下载与网页相关的js,css,img,flash,iframe等
4.修改js,css,img,flash,iframe的路径
5.添加注释<!-- saved from url=("+new DecimalFormat("0000").format(url.length())+")"+url+" -->,网页不会弹出限制运行脚本提示
6.按照编码方式生成本地页面
工具类:
实体类public class HtmlFileLink {private String href;private String filename;private String type;/** * @return the type */public String getType() {return type;}/** * @param type the type to set */public void setType(String type) {this.type = type;}public HtmlFileLink(String href, String filename,String type) {super();this.href = href;this.filename = filename;this.type = type;}public HtmlFileLink() {super();}/** * @return the href */public String getHref() {return href;}/** * @param href the href to set */public void setHref(String href) {this.href = href;}/** * @return the filename */public String getFilename() {return filename;}/** * @param filename the filename to set */public void setFilename(String filename) {this.filename = filename;}}