2 Replies Latest reply: Mar 17, 2008 10:32 AM by 807591 RSS

    CustomTag reading a relative URI on the webserver

      Hi All,

      I am coding a CustomTag which reads a servlet(it resides on the same webserver) output and prints in the UI when this customtag is included in any jsp.
      I am have some issues connecting to the servlet with relative URL. I can connect and get the servlet response by using

      URL url = new URL("http://localhost:9080/buildMenu/");
      URLConnection uc = url.openConnection();
      BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));

      The above code works perfectly fine and i am able read the response. But to make this generic (working on any port and even in other environments)
      i am planning to reading using the relative path "/buildMenu" instead of full path. I was not able to find a way to do that. I would really appreciate if you
      can point me in the right direction.

      Thanks a lot.