You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Herold <he...@cotagesoft.com> on 2002/09/18 02:23:07 UTC
Getting port, path in servlet init()
I would like to construct, in a servlet's init() method, the URL by which
this servlet will be accessed, at least up to the name of the web-app.
For instance, if I have set up to access the webapp as
http://www.me.com:8080/myapp/ I want to end up with:
String protocol = "http";
String hostname = "www.me.com";
int port = 8080;
String path = "myapp";
Protocol I can assume is http.
Hostname I can get using InetAddress.getLocalHost().getHostName()
How can I get the port and the path?
Thanks for your suggestions...
-- bob
----------
Robert Herold
Cotagesoft, Inc.
650 474 9013 x808
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>