R: Crap bytes in HTTP response
Dear all, I've read the below-mentioned message, and it sounds rather cool; I didn't know that a servlet could write to out at any time it likes; how do you manage that? do you have to set the content size before you write? or you just need to flush it out at the end of a chunck? thanx for sending a note daniele rizzi (just curious) -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Per conto di Lachezar Dobrev Inviato: martedì 26 febbraio 2002 9.54 A: Orion-Interest Oggetto: Re: Crap bytes in HTTP response Well... I don't really know what did you do to get this behavior (I am trying for about 6 months to do that, and could not), but that is LEGAL behavior. Look at the Transfer-Encoding: chunked header. That means, that the response from the servlet consists of several chunks. Line 1 ( the 4 thing) means, that there wilkl be 4 bytes of the first chunk. than a newline, than line 3 ( the 0 thing) means there are no more chunks to be sent. Can you please post the whole code? And the web-xml part (orion-web-xml also if applicable)? That way we may look further into the problem? I wish I knew how to do that. That is a VERY useful feature, especialy, when you need to do some heavy-time-consuming things in the servlet. Just post a chunk every couple of seconds, and the browser will NOT timeout. This is VERY useful. Believe me. Lachezar. P.S. I would REALLY like to see your solution. I've got a problem with HttpServletResponse. Here's my test-servlet doGet(): response.setContentType(text/plain); PrintWriter out = response.getWriter(); out.print(TEST); Here's what I get telneting: platon% telnet localhost GET /lux/testz HTTP/1.1 Host: localhost HTTP/1.1 200 OK Date: Mon, 25 Feb 2002 17:57:20 GMT Server: Orion/1.5.4 Connection: Close Content-Type: text/plain Transfer-Encoding: chunked 4 TEST 0 - What 4? What 0? What extra newline? This breaks just about everything. Where did I go wrong, any ideas? Tommi Penttilä
Crap bytes in HTTP response
I've got a problem with HttpServletResponse. Here's my test-servlet doGet(): response.setContentType(text/plain); PrintWriter out = response.getWriter(); out.print(TEST); Here's what I get telneting: platon% telnet localhost GET /lux/testz HTTP/1.1 Host: localhost HTTP/1.1 200 OK Date: Mon, 25 Feb 2002 17:57:20 GMT Server: Orion/1.5.4 Connection: Close Content-Type: text/plain Transfer-Encoding: chunked 4 TEST 0 - What 4? What 0? What extra newline? This breaks just about everything. Where did I go wrong, any ideas? Tommi Penttilä
Re: Crap bytes in HTTP response
Well... I don't really know what did you do to get this behavior (I am trying for about 6 months to do that, and could not), but that is LEGAL behavior. Look at the Transfer-Encoding: chunked header. That means, that the response from the servlet consists of several chunks. Line 1 ( the 4 thing) means, that there wilkl be 4 bytes of the first chunk. than a newline, than line 3 ( the 0 thing) means there are no more chunks to be sent. Can you please post the whole code? And the web-xml part (orion-web-xml also if applicable)? That way we may look further into the problem? I wish I knew how to do that. That is a VERY useful feature, especialy, when you need to do some heavy-time-consuming things in the servlet. Just post a chunk every couple of seconds, and the browser will NOT timeout. This is VERY useful. Believe me. Lachezar. P.S. I would REALLY like to see your solution. I've got a problem with HttpServletResponse. Here's my test-servlet doGet(): response.setContentType(text/plain); PrintWriter out = response.getWriter(); out.print(TEST); Here's what I get telneting: platon% telnet localhost GET /lux/testz HTTP/1.1 Host: localhost HTTP/1.1 200 OK Date: Mon, 25 Feb 2002 17:57:20 GMT Server: Orion/1.5.4 Connection: Close Content-Type: text/plain Transfer-Encoding: chunked 4 TEST 0 - What 4? What 0? What extra newline? This breaks just about everything. Where did I go wrong, any ideas? Tommi Penttilä