How to solve the "Unable to parse form content" error in Jetty?

Last modified by Vincent Massol on 2022/02/21

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

You can edit XWIKI_WEBAPP/WEB-INF/jetty-web.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 1: Setting this value too high can leave your server vulnerable to denial of service attacks.
       Note 2: We're setting it here instead of in Jetty's XML configuration files so that the XWiki WAR can be used
       in any Jetty config and work out of the box.
  -->

 <Set name="maxFormContentSize">10000000</Set>

You can also set the JVM System Property org.eclipse.jetty.server.Request.maxFormContentSize to the value you wish (e.g. -Dorg.eclipse.jetty.server.Request.maxFormContentSize=10000000). You should set this in the JVM options you use when starting the Servlet Container in which XWiki is deployed.

Tags:
   

Get Connected