Author: olamy
Date: Thu Jan 16 22:45:38 2014
New Revision: 1558942
URL: http://svn.apache.org/r1558942
Log:
[MTOMCAT-256] Adding maxPostSize to the tomcat connector
Submitted by Matthias Günther
Modified:
tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm
tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
Modified: tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm?rev=1558942&r1=1558941&r2=1558942&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm (original)
+++ tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm Thu Jan 16
22:45:38 2014
@@ -164,6 +164,7 @@ usage: java -jar [path to your exec war
org.apache.coyote.http11.Http11Nio
Protocol
-httpsPort <httpsPort> https port to use
+ -maxPostSize <maxPostSize> max post size in byte
to use
-keyAlias <keyAlias> alias from keystore for ssl
-loggerName <loggerName> logger to use: slf4j to use slf4j
bridge on top of jul
Modified:
tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java?rev=1558942&r1=1558941&r2=1558942&view=diff
==============================================================================
---
tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java
(original)
+++
tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java
Thu Jan 16 22:45:38 2014
@@ -172,6 +172,16 @@ public abstract class AbstractRunMojo
*/
@Parameter( property = "maven.tomcat.httpsPort", defaultValue = "0" )
private int httpsPort;
+
+ /**
+ * The max post size to run the Tomcat server on.
+ * By default it's 2097152 bytes. That's the default Tomcat configuration.
+ * Set this value to 0 or less to disable the post size limit.
+ *
+ * @since 2.3
+ */
+ @Parameter( property = "maven.tomcat.maxPostSize", defaultValue =
"2097152" )
+ private int maxPostSize;
/**
* The character encoding to use for decoding URIs.
@@ -911,6 +921,7 @@ public abstract class AbstractRunMojo
// create http connector
Connector httpConnector = container.createConnector(
(InetAddress) null, port, protocol );
+ httpConnector.setMaxPostSize(maxPostSize);
if ( httpsPort > 0 )
{
httpConnector.setRedirectPort( httpsPort );
@@ -930,6 +941,7 @@ public abstract class AbstractRunMojo
{
Connector httpsConnector = container.createConnector(
(InetAddress) null, httpsPort, true );
httpsConnector.setSecure( true );
+ httpsConnector.setMaxPostSize(maxPostSize);
httpsConnector.setProperty( "SSLEnabled", "true" );
// should be default but configure it anyway
httpsConnector.setProperty( "sslProtocol", "TLS" );
Modified:
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java?rev=1558942&r1=1558941&r2=1558942&view=diff
==============================================================================
---
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
(original)
+++
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
Thu Jan 16 22:45:38 2014
@@ -196,6 +196,16 @@ public abstract class AbstractRunMojo
private int httpsPort;
/**
+ * The max post size to run the Tomcat server on.
+ * By default it's 2097152 bytes. That's the default Tomcat configuration.
+ * Set this value to 0 or less to disable the post size limit.
+ *
+ * @since 2.3
+ */
+ @Parameter( property = "maven.tomcat.maxPostSize", defaultValue =
"2097152" )
+ private int maxPostSize;
+
+ /**
* The character encoding to use for decoding URIs.
*
* @since 1.0
@@ -1113,6 +1123,7 @@ public abstract class AbstractRunMojo
Connector connector = new Connector( protocol );
connector.setPort( port );
+ connector.setMaxPostSize(maxPostSize);
if ( httpsPort > 0 )
{
@@ -1143,6 +1154,7 @@ public abstract class AbstractRunMojo
{
httpsConnector = new Connector( protocol );
httpsConnector.setPort( httpsPort );
+ httpsConnector.setMaxPostSize(maxPostSize);
httpsConnector.setSecure( true );
httpsConnector.setProperty( "SSLEnabled", "true" );
// should be default but configure it anyway
Modified:
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java?rev=1558942&r1=1558941&r2=1558942&view=diff
==============================================================================
---
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
(original)
+++
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
Thu Jan 16 22:45:38 2014
@@ -86,6 +86,8 @@ public class Tomcat7Runner
public int httpPort;
public int httpsPort;
+
+ public int maxPostSize = 2097152;
public int ajpPort;
@@ -296,6 +298,7 @@ public class Tomcat7Runner
{
Connector connector = new Connector( connectorHttpProtocol );
connector.setPort( httpPort );
+ connector.setMaxPostSize(maxPostSize);
if ( httpsPort > 0 )
{
@@ -319,6 +322,7 @@ public class Tomcat7Runner
{
Connector httpsConnector = new Connector(
connectorHttpProtocol );
httpsConnector.setPort( httpsPort );
+ httpsConnector.setMaxPostSize(maxPostSize);
httpsConnector.setSecure( true );
httpsConnector.setProperty( "SSLEnabled", "true" );
httpsConnector.setProperty( "sslProtocol", "TLS" );
Modified:
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java?rev=1558942&r1=1558941&r2=1558942&view=diff
==============================================================================
---
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
(original)
+++
tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
Thu Jan 16 22:45:38 2014
@@ -47,6 +47,9 @@ public class Tomcat7RunnerCli
static Option httpsPort =
OptionBuilder.withArgName( "httpsPort" ).hasArg().withDescription(
"https port to use" ).create( "httpsPort" );
+
+ static Option maxPostSize =
+ OptionBuilder.withArgName( "maxPostSize" ).hasArg().withDescription(
"max post size to use" ).create( "maxPostSize" );
static Option ajpPort =
OptionBuilder.withArgName( "ajpPort" ).hasArg().withDescription( "ajp
port to use" ).create( "ajpPort" );
@@ -97,7 +100,7 @@ public class Tomcat7RunnerCli
options.addOption( httpPort ).addOption( httpsPort ).addOption(
ajpPort ).addOption( serverXmlPath ).addOption(
resetExtract ).addOption( help ).addOption( debug ).addOption(
sysProps ).addOption(
httpProtocol ).addOption( clientAuth ).addOption( keyAlias
).addOption( obfuscate ).addOption(
- extractDirectory ).addOption( loggerName ).addOption( uriEncoding
);
+ extractDirectory ).addOption( loggerName ).addOption( uriEncoding
).addOption(maxPostSize);
}
@@ -150,6 +153,11 @@ public class Tomcat7RunnerCli
{
tomcat7Runner.httpPort = Integer.parseInt( line.getOptionValue(
httpPort.getOpt() ) );
}
+
+ if ( line.hasOption( maxPostSize.getOpt() ) )
+ {
+ tomcat7Runner.maxPostSize = Integer.parseInt( line.getOptionValue(
maxPostSize.getOpt() ) );
+ }
if ( line.hasOption( httpsPort.getOpt() ) )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]