Bug 110058 - c.a.web.URL mixes up ordering of servlet prefix, context prefix and dispatcher prefix
c.a.web.URL mixes up ordering of servlet prefix, context prefix and dispatche...
Status: CLOSED RAWHIDE
Product: Red Hat Web Application Framework
Classification: Retired
Component: other (Show other bugs)
nightly
All Linux
medium Severity high
: ---
: ---
Assigned To: Justin Ross
Jon Orris
:
Depends On:
Blocks: 109665
  Show dependency treegraph
 
Reported: 2003-11-14 10:53 EST by Daniel Berrange
Modified: 2007-04-18 12:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-12-02 17:51:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Diff for fix (3.03 KB, patch)
2003-11-14 11:08 EST, Daniel Berrange
no flags Details | Diff

  None (edit)
Description Daniel Berrange 2003-11-14 10:53:06 EST
Description of problem:

Consider a URL /apps/plaintext/ccm/portal/homepage.jsp

The /apps/ bit is the context prefix, the /plaintext/ bit is the
dispatcher prefix and the /ccm/ bit is the servlet prefix.
Unfortunately the c.a.web.URL class chops the components out in the
order context, servlet, dispatcher prefixes. So when it re-consistutes
the URL you get /apps/ccm/plaintext/portal/homepage.jsp which
obviously doesn't dispatch to anything.

This bug looks like it was always there, but we didn't encounter it
previously because we always mounted apps on / instead of /ccm.


In addition the PageTransformer class is adding the dispatcher prefix
onto the end of the context-prefix variable, so it ends up duplicated
thus:  /ccm/text/text

Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1. Add in an instance of the InternalPrefixerServlet to web.xml
2. Visit the homepage using the prefix defined in web.xml
3. Look at the XML source to view the any URLs in the page
  
Actual results:
URLs are  starting with /ccm/text/pvt


Expected results:
URLs are starting with /text/ccm/pvt


Additional info:

The patch is:

====
//core-platform/dev/src/com/arsdigita/bebop/page/PageTransformer.java#5
-
/var/ccm-devel/dev/dan/aplaws-rickshaw/core/src/com/arsdigita/bebop/page/PageTransformer.java
====
245,247c245
<                  com.arsdigita.web.URL.getDispatcherPath() +
<                  (DispatcherHelper.getDispatcherPrefix(req) == null
? "" :
<                   DispatcherHelper.getDispatcherPrefix(req)));
---
>                  com.arsdigita.web.URL.getDispatcherPath());
==== //core-platform/dev/src/com/arsdigita/web/URL.java#29 -
/var/ccm-devel/dev/dan/aplaws-rickshaw/core/src/com/arsdigita/web/URL.java
====
229,231d228
<         m_url.append(servletPath);
<         m_servletPathEnd = m_url.length();
< 
236a234,236
>         m_url.append(servletPath);
>         m_servletPathEnd = m_url.length();
> 
457a458,466
>      * <p>Experimental</p>
>      * <p>Returns the dispatcher prefix of this request as
>      * set by the InternalPrefixerServlet
>      */
>     public final String getDispatcherPrefix() {
>         return m_url.substring(m_contextPathEnd, m_dispatcherPrefixEnd);
>     }
> 
>     /**
465c474
<         return m_url.substring(m_contextPathEnd, m_servletPathEnd);
---
>         return m_url.substring(m_dispatcherPrefixEnd, m_servletPathEnd);
469,477d477
<      * <p>Experimental</p>
<      * <p>Returns the dispatcher prefix of this request as
<      * set by the InternalPrefixerServlet
<      */
<     public final String getDispatcherPrefix() {
<         return m_url.substring(m_servletPathEnd, m_dispatcherPrefixEnd);
<     }
< 
<     /**
488c488
<         final String pathInfo = m_url.substring(m_dispatcherPrefixEnd);
---
>         final String pathInfo = m_url.substring(m_servletPathEnd);
885c885
<                 return context + servlet + prefix;
---
>                 return context + prefix + servlet;
Comment 1 Richard Li 2003-11-14 10:59:26 EST
btw, can you do diff -uw next time? i personally hate regular ol' diffs...
Comment 2 Daniel Berrange 2003-11-14 11:08:58 EST
Created attachment 95971 [details]
Diff for fix
Comment 3 Justin Ross 2003-11-21 13:10:34 EST
The above fix was applied in perforce change 38216.

Note You need to log in before you can comment on or make changes to this bug.