When I send a large file using a post request the system shows an exception:
java.lang.IllegalStateException: Form too large1105723>200000
at org.mortbay.jetty.Request.extractParameters(Request.java:1404)
at org.mortbay.jetty.Request.getParameter(Request.java:749)......
When I search help for this in Google they give some help e.g.,
webappcontext.setMaxFormContentSize(5000000);
I am using this code but the problem is not solved
Also I am using the code
jettyServer.setAttribute("org.mortbay.jetty.Request.maxFormContentSize", 5000000);
But no result
Note:-I am using Jetty-6.1.0
Try setting System properties via jetty.xml
<Call class="java.lang.System" name="setProperty">
<Arg>org.mortbay.jetty.Request.maxFormContentSize</Arg>
<Arg>500000</Arg>
</Call>
ok you can configure it from your web app
Add WEB-INF/jetty-web.xml file in your web application and configure the parameter in that file:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure id="WebAppContext" class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="maxFormContentSize" type="int">600000</Set>
</Configure>
Document
Since version 7, Jetty's classes have moved to a different package. You must replace org.mortbay...
with org.eclipse...
(Thanks to David for his comment).
import org.mortbay.jetty.Server;
//... other code here...//
int port = 8080;
Server server = new Server(port);
server.setAttribute("org.mortbay.jetty.Request.maxFormContentSize", -1);
This code works on jetty 6.0.2 which I'm using.
The size of "-1" means the form has no limit I tryed to post a form large 20,000,000 bytes and I had no problem.
For eclipse releases of Jetty(jetty 7) you have to use the following code:
import org.eclipse.jetty.server.Server;
//... other code here...//
int port = 8080;
Server server = new Server(port);
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1);
Unfortunately, I'm not able to make any changes to jetty.xml, so instead I simply set some options to adjust the maxFormContentSize like so:
JVM_OPTS="$JVM_OPTS -Dorg.eclipse.jetty.server.Request.maxFormContentSize=5000000"
This exists in the shell script that we use to launch our instance of Solr.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With