Hello!

We are using embedded tomcat so we can ran a webapp directly from CD. A small Java app
presents a GUI and starts tomcat. A button on the GUI opens the system's browser on
http//localhost:port and the user can use the webapp. Even works on windows and Mac :-)


The not so prefect thing right now is that we have to pick a port number, like 12345 and hope
that it's not being used.


I've tried the following code, binding to port 0:

    Connector connector =
      embedded.createConnector((String)null, 0, false);

    embedded.addConnector(connector);

And it works, tomcat starts, and if I find out the port looking at netstat I can use the webapp.
What I haven't found out is a way to extract from tomcat the port number that the OS chose.
Is there a simple way to get it?


I'm also thinking of changing the default SocketFactory to a custom one which would give me the port number.
Is this a likely path?


Thank you all for any help you can give me.

PS: we're using tomcat 5.0.28.

---
Henrique Gomes


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to