日期:2014-05-20 浏览次数:20899 次
/* * Create by: zhouwenfan * Email:fan962464@126.com * Time: 2010-09-08 */ package com.lucene.mysql; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.GetMethod; public class CreateStaticPage { public static void main(String[] args) { try{ HttpClient client = new HttpClient(); //client.getHostConfiguration().setHost("http://www.baidu.com"); //读取要生成静态页面的页面 GetMethod get = new GetMethod("http://www.baidu.com"); client.executeMethod(get); String s = get.getResponseBodyAsString(); //生成的静态页面存放的位置及名称 BufferedWriter bw = new BufferedWriter(new FileWriter(new File("d://baidu.html"))); bw.write(s); bw.close(); get.releaseConnection(); }catch (Exception ex ){ System.out.print(ex); } } }