Jump to: navigation, search

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

< Jetty‎ | Howto
m
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Jetty Howto
 
{{Jetty Howto
|introduction = Modifying the maximum permissable size of submitted form content.
+
|introduction = 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.
  
== Form Content Size ==
+
== Changing the Maximum Form Size for a Single Webapp ==
 
+
Jetty limits the amount of data that can be posted 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 permitted by Jetty 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 for a single webapp ==
+
  
 
The method to invoke is:
 
The method to invoke is:
Line 19: Line 10:
 
</source>
 
</source>
  
You can do this either in a [[Jetty/Feature/ContextDeployer|context xml deployment descriptor]] externally to the webapp, or in a jetty-web.xml file in the webapp's WEB-INF directory.
+
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:
+
In either case the syntax of the XML file is the same:
  
 
<source lang="xml">
 
<source lang="xml">
Line 33: Line 24:
 
</source>
 
</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 max form content size:
+
Set an attribute on the Server instance for which you want to modify the maximum form content size:
  
 
<source lang="xml">
 
<source lang="xml">
Line 46: Line 37:
 
</source>
 
</source>
  
== Changing for all apps in the jvm ==
+
== Changing the Maximum Form Size for All Apps in the JVM==
  
 
Use the system property "org.eclipse.jetty.server.Request.maxFormContentSize".
 
Use the system property "org.eclipse.jetty.server.Request.maxFormContentSize".

Revision as of 14:49, 18 August 2011



Introduction

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".