Author: olamy Date: Mon Nov 4 04:12:13 2013 New Revision: 1538502 URL: http://svn.apache.org/r1538502 Log: [MTOMCAT-92] Bind tomcat to a self-chosen network interface
Modified: 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 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=1538502&r1=1538501&r2=1538502&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 Mon Nov 4 04:12:13 2013 @@ -136,6 +136,16 @@ public abstract class AbstractRunMojo private int port; /** + * + * For servers with more than one IP address, this attribute specifies which address + * will be used for listening on the specified port. + * By default, this port will be used on all IP addresses associated with the server. + * @since 2.2 + */ + @Parameter( property = "maven.tomcat.address") + private String address; + + /** * The AJP port to run the Tomcat server on. * By default it's 0 this means won't be started. * The ajp connector will be started only for value > 0. @@ -909,6 +919,13 @@ public abstract class AbstractRunMojo } httpConnector.setURIEncoding( uriEncoding ); httpConnector.setUseBodyEncodingForURI( this.useBodyEncodingForURI ); + + if ( address !=null) + { + //ici + httpConnector.setAttribute( "address", address ); + } + container.addConnector( httpConnector ); // create https connector 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=1538502&r1=1538501&r2=1538502&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 Mon Nov 4 04:12:13 2013 @@ -151,6 +151,16 @@ public abstract class AbstractRunMojo private int port; /** + * + * For servers with more than one IP address, this attribute specifies which address + * will be used for listening on the specified port. + * By default, this port will be used on all IP addresses associated with the server. + * @since 2.2 + */ + @Parameter( property = "maven.tomcat.address") + private String address; + + /** * The AJP port to run the Tomcat server on. * By default it's 0 this means won't be started. * The ajp connector will be started only for value > 0. @@ -1111,6 +1121,11 @@ public abstract class AbstractRunMojo connector.setRedirectPort( httpsPort ); } + if ( address !=null) + { + connector.setAttribute( "address", address ); + } + connector.setURIEncoding( uriEncoding ); connector.setUseBodyEncodingForURI( this.useBodyEncodingForURI ); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org