tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to get Tomcat HTTP port during startup of the server
Date Thu, 06 Oct 2011 18:57:35 GMT
Hash: SHA1


On 10/6/2011 2:21 PM, Lahiru Gunathilake wrote:
> This is my usecase, I want to register my application URL to a
> repository and there is another remote application who reads that
> URL somewhere and invoke my application. So during the startup I
> need to register them before I get any request.

Can you solve this with configuration? It seems like simply adding
something like "URLBackToMe" could be configured in a properties file,
web.xml init-param, or even in the JNDI context for the webapp. That
will almost certainly be easier and less error-prone than trying to
sniff the HTTP port from one of Tomcat's connectors.

In production, we have two connectors: one HTTP and one AJP. The AJP
connector accepts connections from the load-balancer for "regular"
traffic. The HTTP connector accepts localhost-only loopback
connections for operations that do not need to be encrypted. We have
both the "public" and "private" URLs to our webapp in configuration
files so that they can be used as appropriate depending upon the

If you had a setup like the above (particularly if you were using two
HTTP connectors instead of one AJP and one HTTP), you might not be
able to tell which connector was the "right" one. Also, you might have
connectors bound to different interfaces to support multi-hostname
SSL, etc. In those cases, how do you determine what the "right" port is?

I think it's better to solve this with configuration instead of trying
to determine the environment from the inside.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message