Advertisement

08.07.2008 at 07:43AM PDT, ID: 23629476
[x]
Attachment Details

Get Request URL

Asked by R7AF in Java Programming Language, Java Server Pages (JSP), J2EE

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
[+][-]08.07.2008 at 07:46AM PDT, ID: 22181458

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 08:29AM PDT, ID: 22181927

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 08:35AM PDT, ID: 22181999

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 08:40AM PDT, ID: 22182075

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 08:45AM PDT, ID: 22182116

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 08:59AM PDT, ID: 22182292

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 04:39PM PDT, ID: 22186452

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.07.2008 at 04:39PM PDT, ID: 22186455

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Java Server Pages (JSP), J2EE
Sign Up Now!
Solution Provided By: objects
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628