日期:2014-05-19 浏览次数:20725 次
response.setContentType("text/xml"); response.setCharacterEncoding("utf-8"); PrintWriter out=null; try { out=response.getWriter(); msg.append("<data>"); msg.append(sbf.toString()); msg.append("</data>"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } out.print(msg.toString()); out.flush();//加上这个就会在数据前自动加上大小及最后一个0 out.close();
HTTP/1.1 200 OK Date: Wed, 27 Jun 2012 05:26:51 GMT Server: Apache/2.2.22 (FreeBSD) PHP/5.2.6 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.7e-p1 X-Powered-By: PHP/5.2.6 Cache-Control: private, must-revalidate, max-age=0, proxy-revalidate, no-transform Pragma: no-cache Vary: Accept-Encoding Connection: close Transfer-Encoding: chunked Content-Type: text/html [color=#FF0000]321e[/color] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--[71,88,7] published at 2012-06-19 16:22:21 from #187 by 6050--> <!doctype html> <html> <head>