Search code examples
spark-java

Is there a way to set content length of post request?


I'm using the Spark web framework

Spark

I need to increase the limit of the request

is it possible?


Solution

  • With the Spark API you can only set the content length for the response (package spark, class Response, method header()).

    In Jetty you can set the attribute org.eclipse.jetty.server.Request.maxFormContentSize (Jetty documentation) and change the limit of the form.
    Currently it's not possible to change directly the Jetty settings through Spark, however there is an open issue in github (issue) to solve this problem.

    Update

    Now it's possible to configure the Jetty server (source).