1 Reply Latest reply on Dec 29, 2004 2:03 AM by kiran kiran

    Need hostname and port number and context path at startup

    treespace Novice

      I want to load one of my own URLs at startup time and would like to build the URL dynamically. For example: https://foo:8080/bar/baz.xml

      I can genrate that URL easily using these request methods and a little glue:

      request.getScheme()
      request.getServerName()
      request.getServerPort()
      request.getContextPath()

      Where can I get these values if I do not have an HttpRequest object? Not even the ServletConfig or ServletContext have this information. If they did then I could grab this stuff from the init() method of a load-on-startup servlet. I do not want to declare these values in web.xml init-params for each deployment.

      Ideas?