Thanks IsuruP. I have written a javascript method for jaggery applications to get the current address of the server[1].
[1] - https://gist.github.com/dulichan/9577696 Cheers~ On Sat, Mar 15, 2014 at 10:06 AM, Isuru Perera <[email protected]> wrote: > Hi, > > The 'carbon.local.ip' system property is set from CarbonServerManager > class [1]. > > System.setProperty(ServerConstants.LOCAL_IP_ADDRESS, > NetworkUtils.getLocalHostname()); > > This NetworkUtils class [2] internally calls an Axis2 Util class [3] to > get the hostname. > > hostName = org.apache.axis2.util.Utils.getIpAddress(); > > With this way, we cannot make sure which IP will be returned at runtime if > there a multiple network interfaces. > > We deal this in production by setting proper hostnames in carbon.xml for > HostName and MgtHostName. We also set hostnames/IP addresses for all other > configurations. > > IMHO, the code should not depend on this 'carbon.local.ip' system > property. The code should always get the hostname via some configuration > value. > > If you also need to make sure the transport is bound to one network, you > need to look at each transport configuration. > > For Servlet transport, you may use address property in Tomcat connectors > [4]. > > For Synapse NIO, you can use bind-address property in axis2.xml transport > configuration. > > The bind-address is not yet implemented for Synapse passthrough transport > [5]. > > Thanks! > > Best Regards, > > [1] > https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/core/org.wso2.carbon.core/4.2.0/src/main/java/org/wso2/carbon/core/init/CarbonServerManager.java > [2] > https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/core/org.wso2.carbon.utils/4.2.0/src/main/java/org/wso2/carbon/utils/NetworkUtils.java > [3] > http://axis.apache.org/axis2/java/core/api/org/apache/axis2/util/Utils.html#getIpAddress%28%29 > [4] http://wiki.apache.org/tomcat/FAQ/Connectors#Q6 > [5] > http://stackoverflow.com/questions/21601792/wso2-api-manager-how-to-listen-passthroughhttplistener-on-single-ip-address > > > > On Sat, Mar 15, 2014 at 9:16 AM, Chan <[email protected]> wrote: > >> Hi folks, >> How does carbon recognize the local ip of the machine? For example if the >> machine has two ips what will be used as the ip for the 'carbon.local.ip' >> system property? I had a strange issue when I am connected to the wifi and >> connected using a dongle as well - carbon picks up the dongle ip rather >> than the network ip. If this is the accepted behavior - how does it deal in >> production? >> >> Cheers~ >> >> -- >> Chan (Dulitha Wijewantha) >> Software Engineer - Mobile Development >> WSO2Mobile >> Lean.Enterprise.Mobileware >> * ~Email [email protected] <[email protected]>* >> * ~Mobile +94712112165 <%2B94712112165>* >> * ~Website dulitha.me <http://dulitha.me>* >> * ~Twitter @dulitharw <https://twitter.com/dulitharw>* >> *~SO @chan <http://stackoverflow.com/users/813471/chan>* >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Isuru Perera > Senior Software Engineer | WSO2, Inc. | http://wso2.com/ > Lean . Enterprise . Middleware > > about.me/chrishantha > -- Chan (Dulitha Wijewantha) Software Engineer - Mobile Development WSO2Mobile Lean.Enterprise.Mobileware * ~Email [email protected] <[email protected]>* * ~Mobile +94712112165* * ~Website dulitha.me <http://dulitha.me>* * ~Twitter @dulitharw <https://twitter.com/dulitharw>* *~SO @chan <http://stackoverflow.com/users/813471/chan>*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
