Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
ServletExec Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 200
Product ServletExec
Category HTTP Connections
Question Does ServletExec support HTTP/1.1 persistent connections ?
Answer Yes.
The first version of ServletExec to support this feature was SE 4.0b1.
There are some conditions which must be met in order to take advantage of this feature:
  1. The request must be made using the HTTP 1.1 protocol.
    For example:
    GET /index.jsp HTTP/1.1
  2. The request must not send the request header named Connection with the value of Close.
  3. The response must set the response header named Content-Length with the appropriate value. This would be done in your servlet code using the setContentLength() method of the Response object. Otherwise ServletExec has no way of knowing how many bytes a dynamically generated response will be and would therefore have to send a response header named Connection with a value of Close thereby telling the client to close the connection.

Note that there is an alternative to the 3rd requirement:
You could use Chunked encoding instead (where each chunk of response data sent to the client has its own sort of content-length information telling how big that response chunk is, and whether or not it is the last chunk). With the Apache webserver, in the absence of the response header named Content-Length, chunked encoding is used by default for sending responses to the client. With other webserver (IIS and iPlanet) you would need to manage this in your servlet. The complete steps for writing your servlet code so that it sends a chunked response are beyond the scope of this FAQ, however the general idea for doing this is:
  • set the HTTP 1.1 response header named Transfer-Encoding with a value of chunked
  • When sending the response body (out.println()), the format of the body must conform to that of a Chunked-body as defined by the HTTP/1.1 Specification.

Readers of this FAQ may also find FAQ #43 to be of interest.

Note: While it is possible to use chunked encoding in either direction (for both requests and responses) ServletExec does not currently support chunked requests. However there may be a workaround

company media information terms of use privacy policy contact us