自制chuncked http streaming 流

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
dddddddddddd----
sb
大家 好
<%
System.out.println("44444444dd");
//Response.Write("4444444ddd");
//PrintWriter pw=response.getWriter().write("ZZZZZZZZZZZZZZ");
//out.print("fffffffffffffffff");
out.print("fffffffffffff");
out.flush();
out.print("zzzz<br/>");
out.flush();
out.print("zz<br/>");
%>
</body>
</html>






能过http live header 插件 查看的结果


http://localhost:8080/jsp_test/NewFile.jsp

GET /jsp_test/NewFile.jsp HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: JSESSIONID=681A03A3D80C0F0155F1732EB055822F
Cache-Control: max-age=0

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Date: Mon, 12 Mar 2012 08:25:04 GMT

你可能感兴趣的:(Stream)