title: spark java: how to handle multipart/form-data input?
body: <p>I am using <a href="http://sparkjava.com/">spark</a> to develop a web application; the problem occurs when I want to upload a file:</p>
  
  <pre><code>public final class SparkTesting
  {
      public static void main(final String... args)
      {
          Spark.staticFileLocation("/site");
  
          Spark.port(8080);
  
          Spark.post("/upload", (request, response) -&gt; {
              final Part uploadedFile = request.raw().getPart("uploadedFile");
              final Path path = Paths.get("/tmp/meh");
              try (final InputStream in = uploadedFile.getInputStream()) {
                  Files.copy(in, path);
              }
  
              response.redirect("/");
              return "OK";
          });
      }
  }
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>[qtp509057984-36] ERROR spark.webserver.MatcherFilter - 
  java.lang.IllegalStateException: No multipart config for servlet
      at org.eclipse.jetty.server.Request.getPart(Request.java:2039)
      at javax.servlet.http.HttpServletRequestWrapper.getPart(HttpServletRequestWrapper.java:361)
      at com.github.fge.grappa.debugger.web.SparkTesting.lambda$main$0(SparkTesting.java:20)
      at com.github.fge.grappa.debugger.web.SparkTesting$$Lambda$1/920011586.handle(Unknown Source)
      at spark.SparkBase$1.handle(SparkBase.java:264)
      at spark.webserver.MatcherFilter.doFilter(MatcherFilter.java:154)
      at spark.webserver.JettyHandler.doHandle(JettyHandler.java:60)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:179)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
      at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:451)
      at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:252)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:266)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:240)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>And even if I try and specify the type explicitly, as in:</p>
  
  <pre><code>Spark.post("/upload", "multipart/form-data", etc etc)
  </code></pre>
  
  <p>it will still fail.</p>
  
  <p>I could probably find a library to parse multipart/form-data, grab the whole content and just parse myself, but that'd be a waste.</p>
  
  <p>Can I configure spark to handle that case?</p>