title: How to get Server Name, Port and Context
body: <p>I have Java Web app.</p>
  
  <p>I need get its URL where it is running (e.g. <code>http://myserver:8080/mycontext</code>).</p>
  
  <p>I need it because I want to be able construct URL on some resource, that has been created.</p>
  
  <p>e.g. By soap request was created resource <code>/myresource</code> and I need insert into soap response reference on this resource (<code>http://myserver:8080/mycontext/myresource</code>)</p>
  
  <p>And I need to be able return URL on resource even when message come from JMS.</p>
  
  <ol>
  <li>Is it possible to determine application URL during startup? e.g. in <code>ServletContextListener</code>.</li>
  <li>Or how it is beeing solved?</li>
  </ol>