I am using Jetty 7.6 with Scalatra web framework. In some of the requests, I need to send a large text as response body to the client, I use HttpServletResponse.getWriter() to write response.
I noticed that on client side I receive 413 Header Full error. Apparently one solution to this problem in Jetty is to increase jetty's header-buffer-size value.
I would like to know what does HttpServletResponse.getWriter() has to do with the size of the header of request ?! As I understand HttpServletResponse.getWriter() writes into response body rather than response header.
I appreciate if someone could explain this issue.
Unfortunately, this is not only headers that matters (like joakime thougth). Jetty has a buffer for headers and a buffer for request.
There is the same thing (buffer) for the answer but hopefully Http is designed to send "chunked" response.
I'm facing the same problem with an upload.
What I've found is that you can set the size of those buffers. See: http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/nio/SelectChannelConnector.html
You can use jetty.xml file to do it :
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="requestHeaderSize">8192</Set>
</New>
</Arg>
</Call>
</Configure>