Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1318
  • Last Modified:

Force chunked encoding response

Hi,

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.

0
Moskaluke
Asked:
Moskaluke
  • 2
  • 2
1 Solution
 
BigRatCommented:
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.
0
 
MoskalukeAuthor Commented:
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.

 
0
 
BigRatCommented:
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/
0
 
MoskalukeAuthor Commented:
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 ?

Thanks

0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now