The maximum form value in Jetty is 200KB by default. Spark uses Jetty, so it's similar to this.
It seems that there are various setting methods for Jetty alone, but it is quite annoying for Spark.
I will omit the details, but the method is as follows.
python
public class Main {
public static void main(String[] args) {
EmbeddedServers.add(EmbeddedServers.Identifiers.JETTY, new EmbeddedJettyFactory(new MyJettyServerFactory()));
get("/", () -> "Hello Spark!");
}
}
class MyJettyServerFactory implements JettyServerFactory {
/**
* Creates a Jetty server.
*
* @param maxThreads maxThreads
* @param minThreads minThreads
* @param threadTimeoutMillis threadTimeoutMillis
* @return a new jetty server instance
*/
@Override
public Server create(int maxThreads, int minThreads, int threadTimeoutMillis) {
Server server;
if (maxThreads > 0) {
int max = maxThreads;
int min = (minThreads > 0) ? minThreads : 8;
int idleTimeout = (threadTimeoutMillis > 0) ? threadTimeoutMillis : 60000;
server = new Server(new QueuedThreadPool(max, min, idleTimeout));
} else {
server = new Server();
}
server.setAttribute("org.eclipse.jetty.server.Request.maxFormKeys", 20000); //Maximum number of POST data
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", 5000000); //Maximum value of POST data
return server;
}
/**
* Creates a Jetty server with supplied thread pool
* @param threadPool thread pool
* @return a new jetty server instance
*/
@Override
public Server create(ThreadPool threadPool) {
return threadPool != null ? new Server(threadPool) : new Server();
}
}
By the way, unless you get the value of the form programmatically, no error will occur. What about the specifications?