You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rf <ru...@yahoo.com> on 2003/02/05 13:32:39 UTC

Fwd: tomcat's serlvet container and http


Hello
I have some questions related to how tomcat's servlet
container handles some HTTP/1.1 issues. Understanding
these, I think, would be beneficial in improving the
performance of my web-application. Here they go:

1. How can my servlet respond with transfer encoding
as chunked? When is my serlvet's OutputStream
committed? I dont have all my data ready, I want send
it out in chunks - how do I do it?

2. How can I use "100 Continue" response header? This
is usually used on slow links, but I want to use it
when my processing is slow. My servlet is doing some
processing and is going to take some more time - how
do I inform this to my client? Can I just set
HttpServletResponse.setStatus (SC_CONTINUE)? (Can this
response be sent more than once?) If this method is
not right for the scenario, what is the recommended
way of informing the client to patiently wait for some
more time?

3. The response in HTTP/1.1 can have "footers" in
addition to "headers", how do I set a "footer"? I
guess we cannot use HttpServletResponse.setHeader
because the servlet spec says setting a header has no
effect if the response is already committed.

4. Persistant connections - is this configurable in a
tomcat? It might be the case that this is not
something a user should bother about, the servlet
container will take care of it. What does tomcat do?
Whenever needed, I want to recommend my client to use
a persistant connection for following requests. Can I
do it? An IE question: what factors determine that IE
should use a persistant connection?

5. If-modified-since header. There is a
getLastModified method in the servlet interface, this
returns a long(for date). I guess I should implement
this method for tomcat to respect the
if-modified-since header. I recently implemented a
caching filter, which intelligently uses the default
servlet to serve cached static content. But since the
former method is simple and more effective, I would
like to know when IE uses this header. Since this
header is optional, how do I recommend IE to use it?

Thank you,
~rf



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Fwd: tomcat's serlvet container and http

Posted by Remy Maucherat <re...@apache.org>.
rf wrote:
> 
> Hello
> I have some questions related to how tomcat's servlet
> container handles some HTTP/1.1 issues. Understanding
> these, I think, would be beneficial in improving the
> performance of my web-application. Here they go

> 1. How can my servlet respond with transfer encoding
> as chunked? When is my serlvet's OutputStream
> committed? I dont have all my data ready, I want send
> it out in chunks - how do I do it?

This is not your servlet's problem (it's the container's problem).

> 2. How can I use "100 Continue" response header? This
> is usually used on slow links, but I want to use it
> when my processing is slow. My servlet is doing some
> processing and is going to take some more time - how
> do I inform this to my client? Can I just set
> HttpServletResponse.setStatus (SC_CONTINUE)? (Can this
> response be sent more than once?) If this method is
> not right for the scenario, what is the recommended
> way of informing the client to patiently wait for some
> more time?

You cannot use 100 with the Servlet API. As Tomcat is already using 100 
(it is sent just before invoking the servlet if it has been requested by 
the client), you actually shouldn't try doing anything with it.
Again, it is a protocol feature, and your servlet should nt try to do 
anything with it.

> 3. The response in HTTP/1.1 can have "footers" in
> addition to "headers", how do I set a "footer"? I
> guess we cannot use HttpServletResponse.setHeader
> because the servlet spec says setting a header has no
> effect if the response is already committed.

This is not supported by the Servlet API.

> 4. Persistant connections - is this configurable in a
> tomcat? It might be the case that this is not
> something a user should bother about, the servlet
> container will take care of it. What does tomcat do?
> Whenever needed, I want to recommend my client to use
> a persistant connection for following requests. Can I
> do it? An IE question: what factors determine that IE
> should use a persistant connection?

Same here, it is a protocol feature.

> 5. If-modified-since header. There is a
> getLastModified method in the servlet interface, this
> returns a long(for date). I guess I should implement
> this method for tomcat to respect the
> if-modified-since header. I recently implemented a
> caching filter, which intelligently uses the default
> servlet to serve cached static content. But since the
> former method is simple and more effective, I would
> like to know when IE uses this header. Since this
> header is optional, how do I recommend IE to use it?

That's one of the few things your servlet should handle. There are 
examples in the Tomcat code if you need some.

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org