javaは静的なページを生成してhttpを送信します。


package com.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br=null;
		InputStreamReader ir=null;
		URLConnection uc=null;
		FileOutputStream fs=null;
		PrintWriter pw=null;
		try {
			URL url=new URL("http://www.qq.com/");
			uc=url.openConnection();
			
			uc.setRequestProperty("accept", "/");
			uc.setRequestProperty("connection", "Keep-Alive");
			uc.setRequestProperty("user-agent", "Mozilla/4.0(Compatible;MSIE 6.0;Windows NT 5.1; SV1)");
			
			uc.connect();
			br=new BufferedReader(new InputStreamReader(uc.getInputStream()));
			String line=null;
			File file=new File("qq.html");
			fs=new FileOutputStream(file);
			pw=new PrintWriter(fs);
			
			while((line=br.readLine())!=null){
				System.out.println(line+"
"); byte[] bytes=line.getBytes("gb2312"); pw.println(new String(bytes)); } System.out.println(file.getAbsolutePath()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { br.close(); fs.close(); pw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }