Bug 84710

Summary: Login UI prepends context path twice when mounted somewhere other than "/"
Product: [Retired] Red Hat Web Application Framework Reporter: Oliver Stewart <oliver>
Component: uiAssignee: ccm-bugs-list
Status: CLOSED EOL QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: nightly   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 17:59:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Oliver Stewart 2003-02-20 20:39:09 UTC
Description of problem:
When mounted somewhere other than "/", the login UI prepends the context path
twice, causing links to point to invalid locations.

Version-Release number of selected component (if applicable):
5.3.0.AUTO.02.18.2003

How reproducible:
Reproducible

Steps to Reproduce:
1. Mount CCM at "/ccm"
2. Set context path to "/ccm", and servlet path to "" in enterprise.init
3. Load "<hostname>/ccm/" in a browser.  The site should redirect to /ccm/register.
4. Click on any link on the page.
    
Actual results:
The selected link will be to "/ccm/ccm/wherever"

Expected results:
The link should point to "/ccm/wherever"

Additional info:
bebop.Link prepends the DispatcherPath to any absolute location
(bebop/Link.java:251).  The admin UI creates links with absolute paths to the
site root, not the context root, by calling Initializer.getFullURL(), which
prepends SiteNode.getRootSiteNode().getURL(req). 
(kernel/security/Initializer.java:303,313)  Replacing getRootURL(req) in
getFullURL() (kernel/security/Initializer.java:303) with "/" seems to solve the
problem.

Comment 1 Oliver Stewart 2003-02-20 20:43:48 UTC
*** Bug 84711 has been marked as a duplicate of this bug. ***

Comment 2 Richard Li 2003-02-20 21:11:32 UTC
What are your enterprise.init parameters for the dispatcher and web
initializers? Also, what your servlet mappings in your web.xml? On first glance,
this appears to be a config problem.

Comment 3 Oliver Stewart 2003-02-20 21:32:28 UTC
That's what I thought too, but tweaking dispatcher[Context|Servlet]Path didn't
seem to help, and going through the code pointed to the solution mentioned (see
the Additional Info above).  bebop.Link.prepareURL(PageState,String) prepends
the dispatcher path, kernel.security.Initializer.getRootURL(HttpServletRequest)
called by kernel.security.Initializer.getFullURL(String,HttpServletRequest)
calls SiteNode.getRootSiteNode().getURL(req).  The latter method prepends the
context path, as does web.URL().getDispatcherPath().  Perhaps the real problem
is that these two (three?) methods of constructing URLs should be reconciled.

init com.arsdigita.web.Initializer {
    defaultScheme = "http";
    serverName = "localhost";
    serverPort = 8080;
    hostName = "ccm.trailmagic.com";
    dispatcherContextPath = "/ccm";
    dispatcherServletPath = "";
}

init com.arsdigita.dispatcher.Initializer { 
    staticURLPrefix = "/STATIC/";

    // Set to 'no' to disable all output of cache control headers
    cachingActive = "yes";

    // Cache expiry time in seconds - eg. Three days.
    defaultExpiry = 259200;
}


Comment 4 Richard Li 2003-02-20 21:34:51 UTC
Assigning to Justin.

Comment 5 Oliver Stewart 2003-02-21 05:49:39 UTC
Hrm... I just have:
    <web-app id='ccm'/>

in my resin.conf.  I'm assuming I don't need anything fancy in there.