But the browser does only one http request for a simple servlet, doesn't it?
If I only have text in my servlet output (no <IMAGE>, etc), how can it help?


> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On
> Behalf Of Craig
> R. McClanahan
> Sent: Wednesday, August 18, 1999 9:12 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Setting content-length
>
>
> "Andr�s Aguiar" wrote:
>
> > Reading Jason Hunter's book and some posts, it seems that
> you should set the
> > content-length method. This is true for any servlet?
> >
>
> Setting the content length is not mandatory, but it is a good idea.
>
> >
> > I mean, the content-length header tells the client how much
> content it will
> > receive, so the client doesn't do another http request
> until all the data is
> > received. If the servlet (as in Jason's book example)
> returns a simple page,
> > why does setting the content-length improves the performance?
> >
>
> In the HTTP/1.0 protocol, each request occurs on a separate
> TCP connection.
> There is some amount of overhead in establishing and
> releasing all these
> connections.
>
> If your servlet engine (or the web server it runs on)
> supports the HTTP/1.1
> protocol, there is a mechanism that can keep a single TCP
> connection open so
> that you can do several requests on it, without paying the
> overhead of creating
> and destroying the connection every time.  This is where the
> performance
> benefit comes from.  But it relies on knowing the content
> length of your
> responses.
>
> Even if you don't set the content length yourself, some
> servlet engines provide
> a certain amount of buffering for the response.  If the
> buffer has not yet been
> filled when your servlet's service() method returns, and you
> haven't set the
> content length yourself, the servlet engine can do it for
> you.  Check the
> documentation on your servlet engine to see if it does this,
> and if you can
> control the size of the output buffer.
>
> Craig McClanahan
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to