Folks, we have a mechanism to override any ports from the carbon.xml file.
See my commit below. Now, Management ports can be overridden from carbon.xml
file. All ports should be able to be overridden from the carbon.xml file.

Can we have all the ports listed?

---------- Forwarded message ----------
From: <[email protected]>
Date: Mon, May 16, 2011 at 2:57 PM
Subject: [Carbon-commits] [Carbon] svn commit r94381 - in trunk/carbon/core:
distribution/carbon-home/repository/conf
org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http
To: [email protected]


Author: azeez
Date: Mon May 16 02:27:49 2011
New Revision: 94381
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=94381

Log:
Ability to override HTTP/S ports from carbon.xml Ports section

Modified:
  trunk/carbon/core/distribution/carbon-home/repository/conf/carbon.xml

trunk/carbon/core/distribution/carbon-home/repository/conf/mgt-transports.xml

trunk/carbon/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http/HttpTransport.java

Modified:
trunk/carbon/core/distribution/carbon-home/repository/conf/carbon.xml
URL:
http://wso2.org/svn/browse/wso2/trunk/carbon/core/distribution/carbon-home/repository/conf/carbon.xml?rev=94381&r1=94380&r2=94381&view=diff
==============================================================================
--- trunk/carbon/core/distribution/carbon-home/repository/conf/carbon.xml
    (original)
+++ trunk/carbon/core/distribution/carbon-home/repository/conf/carbon.xml
    Mon May 16 02:27:49 2011
@@ -110,13 +110,19 @@
            <KDCServerPort>8000</KDCServerPort>
        </EmbeddedLDAP>

-       <!-- Embedded Qpid broker ports -->
+           <!-- Embedded Qpid broker ports -->
        <EmbeddedQpid>
           <!-- Broker TCP Port -->
            <BrokerPort>5672</BrokerPort>
           <!-- SSL Port -->
            <BrokerSSLPort>8672</BrokerSSLPort>
        </EmbeddedQpid>
+
+        <!-- Override the ports defined in mgt-transports.xml -->
+        <ServletTransports>
+            <HTTPS>9443</HTTPS>
+            <HTTP>9763</HTTP>
+        </ServletTransports>
    </Ports>

    <!--

Modified:
trunk/carbon/core/distribution/carbon-home/repository/conf/mgt-transports.xml
URL:
http://wso2.org/svn/browse/wso2/trunk/carbon/core/distribution/carbon-home/repository/conf/mgt-transports.xml?rev=94381&r1=94380&r2=94381&view=diff
==============================================================================
---
trunk/carbon/core/distribution/carbon-home/repository/conf/mgt-transports.xml
      (original)
+++
trunk/carbon/core/distribution/carbon-home/repository/conf/mgt-transports.xml
      Mon May 16 02:27:49 2011
@@ -37,7 +37,8 @@
        -->
        <parameter name="protocol">HTTP_11_NIO</parameter>

-        <parameter name="port">9763</parameter>
+        <!-- ${Ports.ServletTransports.HTTP} is defined in the Ports
section of the carbon.xml -->
+        <parameter name="port">${Ports.ServletTransports.HTTP}</parameter>

        <!--
       Uncomment the following to enable Apache2 mod_proxy. The port on the
Apache server is 80
@@ -80,7 +81,8 @@
        -->
        <parameter name="protocol">HTTPS_11_NIO</parameter>

-        <parameter name="port">9443</parameter>
+        <!-- ${Ports.ServletTransports.HTTPS} is defined in the Ports
section of the carbon.xml -->
+        <parameter name="port">${Ports.ServletTransports.HTTPS}</parameter>

        <!--
       Uncomment the following to enable Apache2 mod_proxy. The port on the
Apache server is 443

Modified:
trunk/carbon/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http/HttpTransport.java
URL:
http://wso2.org/svn/browse/wso2/trunk/carbon/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http/HttpTransport.java?rev=94381&r1=94380&r2=94381&view=diff
==============================================================================
---
trunk/carbon/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http/HttpTransport.java
   (original)
+++
trunk/carbon/core/org.wso2.carbon.server/src/main/java/org/wso2/carbon/server/transports/http/HttpTransport.java
   Mon May 16 02:27:49 2011
@@ -24,6 +24,7 @@
 import org.wso2.carbon.server.transports.Transport;
 import org.wso2.carbon.server.transports.TransportParameter;
 import org.wso2.carbon.tomcat.BetterTomcat;
+import org.wso2.carbon.utils.CarbonUtils;

 import java.util.Map;

@@ -92,17 +93,21 @@
    private int getPort(TransportParameter portParam) {
        int port = name.equals("http") ? 9763 : 9443;
        String portSysProp = System.getProperty(name + "Port");
+        String portParamValue = portParam.getValue();
+        if(portParamValue.startsWith("${")) {
+            portParamValue =
CarbonUtils.getPortFromServerConfig(portParamValue);
+        }
        if (portSysProp != null) {
            try {
                port = Integer.parseInt(portSysProp);
            } catch (NumberFormatException ignored) {
                if (portParam != null) {
-                    port = Integer.parseInt(portParam.getValue());
+                    port = Integer.parseInt(portParamValue);
                }
            }
        } else {
            if (portParam != null) {
-                port = Integer.parseInt(portParam.getValue());
+                port = Integer.parseInt(portParamValue);
            }
        }
        return port;
_______________________________________________
Carbon-commits mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/carbon-commits



-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>**
email: **[email protected]* <[email protected]>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*




-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>**
email: **[email protected]* <[email protected]>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to