Hey,
Is there any way I can get url address of an application from java code, I mean complete address not only value from getContextPath(). Something like http://localhost:8080/etc
Hey,
Is there any way I can get url address of an application from java code, I mean complete address not only value from getContextPath(). Something like http://localhost:8080/etc
In a servlet or JSP, you can call javax.servlet.http.HttpUtils.getRequestURL(request)
It returns a StringBuffer containing the entire URL up to the servlet
From the javadoc
Reconstructs the URL the client used to make the request, using information in the HttpServletRequest object. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
If you only want up to the context path, you'll have to remove your servlet path