|
这个主题共有 2 回复 / 1 页 [
]
|
|
|
|
|
|
一个GZIP编码输出问题
|
2008年01月18日 18:55
|
|
|
如下代码为什么什么都显示不出来呢,应该能打印出hello world的啊,但是显示却是 雪白一边,这里假设浏览器支持gzip编码的,所以许多条件判断就省去了,希望哪位达人能指点迷津啊,代码如下 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); OutputStream out = null; response.setHeader("Content-Encoding", "GZIP"); out=new GZIPOutputStream(response.getOutputStream()); String content="hello world"; PrintWriter pw = new PrintWriter(out); pw.println(content); pw.flush(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); }
|
|
|
|
|
|
回复:一个GZIP编码输出问题
|
2008年01月21日 16:43
|
|
|
|
Tomcat等容器已经提供gzip等压缩插件功能,只要配置一下就可以了。
|
|
|
|
|
|
re:一个GZIP编码输出问题
|
2008年01月23日 11:09
|
|
|
|
|
|
|