Force chunked encoding response

Posted on 2005-03-29
Medium Priority
Last Modified: 2008-01-09

I am working with Tomcat 4.1 .  I would like to generate Tomcat responses using JSP
that truely use chunked encoding (to test a WebClient) -ie. break the response into pieces
with associated lengths.  How do I go about doing this ?  Is there a Tomcat setting to enable
this ?  Do I handle it in the JSP page somehow ?  Is a combination of both server settings and
proper JSP ?

Please help.  Been fighting this one for hours.

Question by:Moskaluke
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 27

Expert Comment

ID: 13752415
As far as I was aware it is Coyote or Apache that actually does the chunking, provided that the request was http/1.1 and offered to accept it.

I'd write a bit of code that sends (say) 500 bytes back and then waits 1 sec and then another 500 bytes and so on.

Author Comment

ID: 13791967
BigRat - Thanks for the response....

So are you saying that I have to get Tomcat working with the Apache Web Server to get Chunking to occur ?

Right now I and simply making jsp page requests to Tomcat listening on port 8080.  Tomcat is executing
the request and generating the response back to the browser ... But i need for this response coming back to be broken
into chunks so that I can test receiving and processing chunks with a browser.

Thank you.

LVL 27

Accepted Solution

BigRat earned 2000 total points
ID: 13804708
Chunking occurs in two situations provided the source has requested it. The first situation is where the content length is unknown (typically from CGI) but Keep-Alive was requested, the second where the data (also from CGI) is streamed and Apache's internal buffer overflows.
   With TomCat there is the added factor of the connector. This has a buffer size of (IFAIK) 8KB so if this overflows chunking ought to take place. Therefore my suggestion is to send large amounts of data back in intervals.

You might look at tools like http://www.joedog.org/siege/

Author Comment

ID: 13817753
Thanks again BigRat (cool name)

I had moved onto to IIS/ASP because I was in a bind.  With IIS you set a registry setting and
turn off buffering and it seems to chunk everything ... small/big doesn't matter  ... Pretty sweet when
you want everything chunked for testing purposes.

Are there similar settings that would cause Tomcat to behave this way ?  When I get back around to it
I will give your way a try though ?



Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question