Howdy, >I totally accept it is not preferable to have a web-app read config content >from the WebServer Container - I just wondered for a particular app I have >inherited for support/maintenance it was possible. >I thought it was not - and I thank you for verifying this fact.
People always rush to say things are impossible. Of course you can do it, with some caveats. First the code: Server server = ServerFactory.getServer(); Service service = server.findServices()[0]; Connector[] connectors = service.findConnectors(); // iterate through connectors, casting as needed e.g. to CoyoteConnector, //and calling getPort() to get the port. Caveats: - Your webapp must be privileged - Your webapp (or the classes that do the above at least) must live in common/lib or common/classes rather than WEB-INF/lib and WEB-INF/classes - This may not work in future versions of tomcat - As he said, and you acknowledged, this is a terrible, non-portable practice that will cause you headaches if you do it for the long term. >My main reason for asking is that I wanted some URL information in init() >methods - and the servlet api allows you only to access URL info via the >Request class. There have been several discussions in the past on this list as to why the Servlet API is designed this way. It comes down to portability and container-independence. Feel free to search the archives for more details. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]