In short: I need to get the domain name of the requested page. So if a user opens the page
www.domain.com/site/index.jsp, I want to get back "
www.domain.com". How can I request this name?
Longer explanation:
I have the following problem, probably related to some proxy settings. I would like to have a fix for this without having to change the proxy settings.
- Take the following domain name and webapp:
www.domain.com/site/- There is an index.jsp inside this folder, which redirects to a page in a subfolder: home/login.jsp
Whenever I open
www.domain.com/site/ in my browser, it redirects to domain.com/site, removing the
www. This wasn't a big problem, but it wasn't like I expected. Now we've setup a certificate for one of the virtual hosts, and since then the redirect goes to https, unless I redirect to an absolute URL. I don't want to use absolute URLs, so I would like to know how I create that absolute URL dynamically. I don't want to specify this URL everytime I install this webapp for different domain names.
I know how to get the path, but not the domain name.
(And I know this should be fixed in the proxy, but I don't control that, and want to fix this now.)
Start Free Trial