title: How can I get the port in my thorntail application from a java class?
body: <p>How could I get from a java class the port where my application?
  For example, with JBoss in standalone.xml I used it is:</p>
  
  <p>standalone.xml</p>
  
  <pre><code>&lt;socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"&gt;
          &lt;socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}" /&gt;
          &lt;socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}" /&gt;
          &lt;socket-binding name="ajp" port="${jboss.ajp.port:8009}" /&gt;
          &lt;socket-binding name="http" port="${jboss.http.port:8080}" /&gt;
          &lt;socket-binding name="https" port="${jboss.https.port:8443}" /&gt;
          &lt;socket-binding name="txn-recovery-environment" port="4712" /&gt;
          &lt;socket-binding name="txn-status-manager" port="4713" /&gt;
          &lt;outbound-socket-binding name="mail-smtp"&gt;
              &lt;remote-destination host="localhost" port="25" /&gt;
          &lt;/outbound-socket-binding&gt;
      &lt;/socket-binding-group&gt;
  </code></pre>
  
  <p>Java class:</p>
  
  <pre><code> Integer port = (Integer) ManagementFactory.getPlatformMBeanServer()
                  .getAttribute(new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http"),
                      "port");
  </code></pre>