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.