All,

I recently wrote a relatively simple Servlet (which is less and less common these days with frameworks, etc.) and I was surprised that I got a chunked response.

Here is the entirety of the servlet code:

public class HtlloWorldServlet
    extends HttpServlet
{
    @Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        response.getWriter().print("Hello World");
    }
}

This is running on Tomcat 9.0.97 on Java 24, connecting directly to Tomcat using an NIO HTTP/1.1 connector.

I have printed the response buffer size and it's 8192 bytes. My expectation was that since I'm writing far less than the buffer size, I would get a Content-Length header and identity Transfer-Encoding, but instead I'm getting Transfer-Encoding: chunked and no Content-Length header.

It's not interfering with the operation of the servlet or the client, but why am I not getting a "simpler" response?

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to