Skip to main content
Jump to: navigation, search

Difference between revisions of "Jetty/Howto/Configure Form Size"

< Jetty‎ | Howto
(New page: {{Jetty Howto | introduction = Modifying the maximum permissable size of submitted form content. ==Form Content Size== == Changing for a single webapp == Context files are normally l...)
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Jetty Howto
 
{{Jetty Howto
| introduction = Modifying the maximum permissable size of submitted form content.
 
  
==Form Content Size==
+
|introduction =  
  
 +
{{Jetty Redirect|http://www.eclipse.org/jetty/documentation/current/setting-form-size.html}}
  
 +
Jetty limits the amount of data that can post back from a browser or other client to the server. This helps protect the server against denial of service attacks by malicious clients sending huge amounts of data. The default maximum size Jetty permits is 200000 bytes. You can change this default for a particular webapp, for all webapps on a particular Server instance, or all webapps within the same JVM.
  
 +
== Changing the Maximum Form Size for a Single Webapp ==
  
== Changing for a single webapp ==
+
The method to invoke is:
  
Context files are normally located in <jetty.home>/contexts/ (see [[Jetty/Feature/ContextDeployer|ContextDeployer]] for more details). Context files can be used to configure the size of the maximum form content:
+
<source lang="java">
 +
ContextHandler.setMaxFormContentSize(int maxSize);
 +
</source>
 +
 
 +
You can do this either in a [[Jetty/Feature/ContextDeployer|context XML deployment descriptor]] external to the webapp, or in a [[Jetty/Reference/jetty-web.xml|<tt>jetty-web.xml</tt> file]] in the webapp's <tt>WEB-INF</tt> directory.
 +
 
 +
In either case the syntax of the XML file is the same:
  
 
<source lang="xml">
 
<source lang="xml">
  
 
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 
  <Set name="contextPath">/</Set>
 
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test.war</Set>
 
 
 
   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
   <!-- Max Form Size                                                  -->
 
   <!-- Max Form Size                                                  -->
Line 23: Line 27:
 
   <Set name="maxFormContentSize">200000</Set>
 
   <Set name="maxFormContentSize">200000</Set>
 
</Configure>
 
</Configure>
 +
</source>
  
== Changing for all apps on a Server ==
+
== Changing the Maximum Form Size for All Apps on a Server ==
 +
 
 +
Set an attribute on the Server instance for which you want to modify the maximum form content size:
  
 
<source lang="xml">
 
<source lang="xml">
<!--?xml version="1.0"  encoding="ISO-8859-1"?-->
 
 
 
 
<configure class="org.eclipse.jetty.server.Server">
 
<configure class="org.eclipse.jetty.server.Server">
 
       <Call name="setAttribute">
 
       <Call name="setAttribute">
Line 35: Line 39:
 
       <Arg>200000</Arg>
 
       <Arg>200000</Arg>
 
     </Call>
 
     </Call>
 +
</configure>
 +
</source>
  
 +
== Changing the Maximum Form Size for All Apps in the JVM==
  
  <set name="maxFormContentSize"></set>
+
Use the system property "org.eclipse.jetty.server.Request.maxFormContentSize".
</configure>
+
  
 
| category = [[category:Jetty Howto]]
 
| category = [[category:Jetty Howto]]
 
}}
 
}}

Latest revision as of 17:46, 30 April 2013



Introduction

Warning2.png
Jetty 7 and Jetty 8 are now EOL (End of Life)




THIS IS NOT THE DOCUMENTATION YOU ARE LOOKING FOR!!!!!






All development and stable releases are being performed with Jetty 9 and Jetty 10.






This wiki is now officially out of date and all content has been moved to the Jetty Documentation Hub






Direct Link to updated documentation: http://www.eclipse.org/jetty/documentation/current/setting-form-size.html


Jetty limits the amount of data that can post back from a browser or other client to the server. This helps protect the server against denial of service attacks by malicious clients sending huge amounts of data. The default maximum size Jetty permits is 200000 bytes. You can change this default for a particular webapp, for all webapps on a particular Server instance, or all webapps within the same JVM.

Changing the Maximum Form Size for a Single Webapp

The method to invoke is:

ContextHandler.setMaxFormContentSize(int maxSize);

You can do this either in a context XML deployment descriptor external to the webapp, or in a jetty-web.xml file in the webapp's WEB-INF directory.

In either case the syntax of the XML file is the same:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Max Form Size                                                   -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Set name="maxFormContentSize">200000</Set>
</Configure>

Changing the Maximum Form Size for All Apps on a Server

Set an attribute on the Server instance for which you want to modify the maximum form content size:

<configure class="org.eclipse.jetty.server.Server">
      <Call name="setAttribute">
      <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
      <Arg>200000</Arg>
    </Call>
</configure>

Changing the Maximum Form Size for All Apps in the JVM

Use the system property "org.eclipse.jetty.server.Request.maxFormContentSize".

Back to the top