Tomcat generates the following exception when processing a post with a line longer than 4096 (including the "\n"): java.io.IOException at org.apache.coyote.tomcat5.InputBuffer.reset(InputBuffer.java:463) at org.apache.coyote.tomcat5.CoyoteReader.reset(CoyoteReader.java:153) at org.apache.coyote.tomcat5.CoyoteReader.readLine (CoyoteReader.java:207) at com.creditex.util.TestServlet.doPost(TestServlet.java:138) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) The following is source for TestServlet: public void doPost(HttpServletRequest request, HttpServletResponse res) throws javax.servlet.ServletException { BufferedReader reqReader = null; int status = res.SC_OK; try{ reqReader = request.getReader(); String s = null; while ((s=reqReader.readLine()) != null) { System.out.println("Read length " + s.length()); } } catch(Exception e){ e.printTrace(); } finally { try { if (reqReader != null) reqReader.close(); res.setStatus(status); } catch (IOException ie) {} } } If length is exactly at 4096 (including "\n"), the servlet does not see the data and no exception is thrown.
This is a (reasonable) limit that I did put in on purpose. See the CoyoteReader source for the constant (and recompile to change it for special purpose applications).
(In reply to comment #1) > This is a (reasonable) limit that I did put in on purpose. See the CoyoteReader > source for the constant (and recompile to change it for special purpose > applications). I don't understand how this is reasonable. If someone sending a request to a webservice, and the request is well formed (doesn't have to have line breaks to be well formed), and it is a request with a lot of data, then this breaks it. Maybe I'm missing something, I don't want to have to force my clients to to insert line breaks in their XML requests when there is nothing in the W3C standard that says XML requests have to contain line breaks. Am I missing something?
(In reply to comment #2) > (In reply to comment #1) > > This is a (reasonable) limit that I did put in on purpose. See the CoyoteReader > > source for the constant (and recompile to change it for special purpose > > applications). > > I don't understand how this is reasonable. If someone sending a request to a > webservice, and the request is well formed (doesn't have to have line breaks to > be well formed), and it is a request with a lot of data, then this breaks it. > Maybe I'm missing something, I don't want to have to force my clients to to > insert line breaks in their XML requests when there is nothing in the W3C > standard that says XML requests have to contain line breaks. > > Am I missing something? > This seems to have been fixed in version 5.5.4.
This cannot be unlimited, so 4KB is a very reasonable constant. Using this method will make your application *extremely* inefficient, BTW.
*** Bug 34829 has been marked as a duplicate of this bug. ***