How to solve the "Form too large" error in Jetty?

Last modified by Vincent Massol on 2015/03/16

This happens because Jetty has a default size for accepting POST data, which can be customized.

If you're using the XWiki Zip distribution, you can edit XWIKI_INSTALL_DIR/jetty/etc/jetty.xml and locate the following configuration:

  <!-- In order to avoid getting a "java.lang.IllegalStateException: Form too large" error when editing large page in
       XWiki we need to tell Jetty to allow for large content since by default it only allows for 20K. We do this by
       passing the "org.eclipse.jetty.server.Request.maxFormContentSize" attribute.
       Note that setting this value too high can leave your server vulnerable to denial of service attacks.
  -->

 <Call name="setAttribute">
   <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
   <Arg><Property name="jetty.maxFormContentSize" default="1000000"/></Arg>
 </Call>

If you're using a different distribution you can simply set the JVM System Property org.eclipse.jetty.server.Request.maxFormContentSize to the value you wish (e.g. -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000). You should set this in the JVM options you use when starting the Servlet Container in which XWiki is deployed.

Get Connected