title: Spring Boot Rest Service Form too large
body: <p>I am using Spring Boot 1.3.2 and I need to expose a REST Web Service. To this web service I need to pass a String (that contains xml data) as parameter. The size of the string is usually between 2 MB and 120 MB. The problem is that I do not know how to configure the maximum size allowed for the REST method parameter and the default size is way too small. The Spring configuration must be in a java class, due to other dependencies. This is my configuration class:</p>
  <pre><code>@Configuration
  @ComponentScan(&quot;eu.buzea&quot;)
  @EnableAutoConfiguration
  @EnableNeo4jRepositories(&quot;eu.buzea.datamodel.repositories&quot;)
  @EnableTransactionManagement
  @SpringBootApplication
  public class Application extends Neo4jConfiguration {
  
      public Application() {
      }
      
      @Override
      public Neo4jServer neo4jServer() {
          return new RemoteServer(&quot;http://localhost:7474&quot;);
      }
      
      @Override
      public SessionFactory getSessionFactory() {
          return new SessionFactory(&quot;eu.buzea.datamodel.entities&quot;);
      }
      
      @Override
      @Bean
      @Scope(value = &quot;session&quot;, proxyMode = ScopedProxyMode.TARGET_CLASS)
      public Session getSession() throws Exception {
          return super.getSession();
      }
      
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  <p>This is how Rest endpoint looks like:</p>
  <pre><code>@RequestMapping(method = RequestMethod.POST)
  public boolean processing(@RequestParam(value = &quot;xml&quot;, required = true) String xml) 
  </code></pre>
  <p>And when I send a String to the method I receive the following error:</p>
  <pre><code>java.lang.IllegalStateException: Form too large: 780963 &gt; 200000
  at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:365) ~[jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:303) ~[jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.Request.extractParameters(Request.java:257) ~[jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.Request.getParameter(Request.java:826) ~[jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:70) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[jetty-servlet-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) [jetty-io-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.14.v20151106.jar:9.2.14.v20151106]
  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.14.v20151106.jar:9.2.14.v20151106]
  at java.lang.Thread.run(Thread.java:745) [na:1.8.0_71]
  2016-04-26 20:32:44 [qtp2021854618-21] WARN  org.eclipse.jetty.http.HttpParser - badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@4d208ff0{r=1,c=false,a=IDLE,uri=}
  </code></pre>
  Can anyone tell me how to set the (<strike>maximum request size</strike>) maximum form content size to be 200 MB or infinite?
  <p><strong>UPDATE</strong>
  The following post gives a solution in case you are using a jetty server, that is not embedded in Spring Boot: <a href="https://stackoverflow.com/questions/3861455/form-too-large-exception">stackoverflow.com/questions/3861455/form-too-large-exception</a></p>
  <p>I want to set the <em>maxFormContentSize</em> parameter, but I am not sure if it is an Eclipse parameter or a Spring parameter.</p>
  <p>P.S. I know now how to solve the problem using MultipartFile Upload. Also, there is another option: to send the String/Data in the request Body. They both work great, but I want to know if it possible to set the <em>maxFormContentSize</em> in Spring  or Eclipse</p>