@@ -81,6 +81,8 @@ public class ServerDaemon implements Daemon {
8181 private static final String ACCESS_LOG = "access.log" ;
8282 private static final String REQUEST_CONTENT_SIZE_KEY = "request.content.size" ;
8383 private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576 ;
84+ private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys" ;
85+ private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000 ;
8486
8587 ////////////////////////////////////////////////////////
8688 /////////////// Server Configuration ///////////////////
@@ -93,6 +95,7 @@ public class ServerDaemon implements Daemon {
9395 private int httpsPort = 8443 ;
9496 private int sessionTimeout = 30 ;
9597 private int maxFormContentSize = DEFAULT_REQUEST_CONTENT_SIZE ;
98+ private int maxFormKeys = DEFAULT_REQUEST_MAX_FORM_KEYS ;
9699 private boolean httpsEnable = false ;
97100 private String accessLogFile = "access.log" ;
98101 private String bindInterface = null ;
@@ -140,6 +143,7 @@ public void init(final DaemonContext context) {
140143 setAccessLogFile (properties .getProperty (ACCESS_LOG , "access.log" ));
141144 setSessionTimeout (Integer .valueOf (properties .getProperty (SESSION_TIMEOUT , "30" )));
142145 setMaxFormContentSize (Integer .valueOf (properties .getProperty (REQUEST_CONTENT_SIZE_KEY , String .valueOf (DEFAULT_REQUEST_CONTENT_SIZE ))));
146+ setMaxFormKeys (Integer .valueOf (properties .getProperty (REQUEST_MAX_FORM_KEYS_KEY , String .valueOf (DEFAULT_REQUEST_MAX_FORM_KEYS ))));
143147 } catch (final IOException e ) {
144148 LOG .warn ("Failed to read configuration from server.properties file" , e );
145149 } finally {
@@ -191,6 +195,7 @@ public void start() throws Exception {
191195 // Extra config options
192196 server .setStopAtShutdown (true );
193197 server .setAttribute (ContextHandler .MAX_FORM_CONTENT_SIZE_KEY , maxFormContentSize );
198+ server .setAttribute (ContextHandler .MAX_FORM_KEYS_KEY , maxFormKeys );
194199
195200 // HTTPS Connector
196201 createHttpsConnector (httpConfig );
@@ -263,6 +268,7 @@ private Pair<SessionHandler,HandlerCollection> createHandlers() {
263268 webApp .setContextPath (contextPath );
264269 webApp .setInitParameter ("org.eclipse.jetty.servlet.Default.dirAllowed" , "false" );
265270 webApp .setMaxFormContentSize (maxFormContentSize );
271+ webApp .setMaxFormKeys (maxFormKeys );
266272
267273 // GZIP handler
268274 final GzipHandler gzipHandler = new GzipHandler ();
@@ -365,4 +371,8 @@ public void setSessionTimeout(int sessionTimeout) {
365371 public void setMaxFormContentSize (int maxFormContentSize ) {
366372 this .maxFormContentSize = maxFormContentSize ;
367373 }
374+
375+ public void setMaxFormKeys (int maxFormKeys ) {
376+ this .maxFormKeys = maxFormKeys ;
377+ }
368378}
0 commit comments