tomcat-users mailing list archives

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

Lahiru,

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
situation.

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6N+h4ACgkQ9CaO5/Lv0PAitACggQjcKsO2YUO4ZCeVoVQfLavH
aE4AniuyPfiQ9/tx3dN9a0wZsExA12Wz
=Gd3G
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message