I do not know if this info is helpful...  ServletRequest has getServerPort()
and getServerName() methods that should give the port and server through
which the request came.

Vamsi

On 8/24/07, Brian Barnett <[EMAIL PROTECTED]> wrote:
>
> Can someone provide a java code snippet showing how to get the port that
> Tomcat is listening on? Is there a way to access the settings in the
> server.xml file from within a running instance of Tomcat?
>
> I'm running a Struts-based app on Tomcat 5.5 (multiple Tomcat instances
> actually) and need to know which port a request just came in on. Ideally,
> I
> would like to set an application scope variable at startup, in a plugin
> class. The plugin class has access to ServletContext and a ModuleConfig
> object, but I was not able to find a way to get the port through those
> objects. Maybe I'm missing it. I looked through ServletContext object and
> could not find it. Could not find access to Catalina's HttpConnector class
> anywhere.
>
> Thanks,
> Brian Barnett
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to