Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 65798 invoked from network); 1 Mar 2003 08:08:09 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 1 Mar 2003 08:08:09 -0000 Received: (qmail 2261 invoked by uid 97); 1 Mar 2003 08:09:59 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 2254 invoked from network); 1 Mar 2003 08:09:58 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 1 Mar 2003 08:09:58 -0000 Received: (qmail 64396 invoked by uid 500); 1 Mar 2003 08:07:57 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 64385 invoked from network); 1 Mar 2003 08:07:56 -0000 Received: from main.gmane.org (80.91.224.249) by daedalus.apache.org with SMTP; 1 Mar 2003 08:07:56 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18p226-0003DI-00 for ; Sat, 01 Mar 2003 09:07:46 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: tomcat-user@jakarta.apache.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18p225-0003D8-00 for ; Sat, 01 Mar 2003 09:07:45 +0100 From: "Bill Barker" Subject: Re: Parasite string length added in the message body Date: Sat, 1 Mar 2003 00:16:28 -0800 Lines: 75 Message-ID: References: X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N For the observant, you will notice the header 'Transfer-Encoding: chunked'. In this case, the HTTP/1.1 protocol requires that the server sends the length of the chunk prior to sending the body of the chunk itself. If you don't want to see this, simply set the content-length header (e.g. response.setContentLength) before sending the output from your servlet. "Raphael Bousquet" wrote in message news:PHEILLNADHPMCNHCBGEFOEOKDBAA.raphael.bousquet@LTUtech.com... > Does someone know why Tomcat (version 4.1.18 Linux and Windows) adds the > string length in the message body? > > Here is what I receive from Tomcat: > -------------------------------------------------- > HTTP/1.1 200 OK > Content-Type: text/xml > Transfer-Encoding: chunked > Date: Fri, 28 Feb 2003 16:59:22 GMT > Server: Apache Coyote/1.0 > Connection: close > > 56 > > > Mike > > > 0 > > -------------------------------------------------- > as you can see the message body contains a '56' and a '0', and I don't know > where they come from? 56 is the size of the string "" in > hex. > > Here is the code of my servlet: > -------------------------------------------------- > package testservlet; > > import java.io.*; > import javax.servlet.*; > import javax.servlet.http.*; > > public class Reply > extends HttpServlet > implements SingleThreadModel > { > private static final String CONTENT_TYPE = "text/xml"; > > //Process the HTTP Get request > public void doGet(HttpServletRequest request, HttpServletResponse response) > throws ServletException, IOException > { > //partner identifier > response.setContentType(CONTENT_TYPE); > PrintWriter out = response.getWriter(); > out.println(""); > out.println(""); > out.println("Mike"); > out.println(""); > out.flush(); > out.close(); > } > } > -------------------------------------------------- > > It is very simple and there is no sign of any string length being written in > the output stream. > > Is this normal? If I am missing something I would really appreciate your > input. Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org