Uploaded image for project: 'Pluto'
  1. Pluto
  2. PLUTO-288

PortletRequestImpl.getContextPath() returns wrong value for root context

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0-beta2
    • Fix Version/s: 1.1.0
    • Component/s: portlet container
    • Labels:
      None

      Description

      The javadoc for HttpServletRequest states that 'For servlets in the default (root) context, this method returns ""'. However PortletRequestImpl is returning the context path from the portletwindowimpl without checking for '/'. getContextPath should check for "/" as the context path and return "" in that case.

      This particular problem causes problems with the c:url tag in JSTL. Referencing a resource with this tag will result in a double slash in the url, which can sometimes cause problems. That is <c:url value="/my/url" /> will result in the value "http://host//my/url" when the web application is in the root context.

        Activity

        Hide
        ddewolf David DeWolf added a comment -

        Thanks!!!! SVN Commit 503316.

        Show
        ddewolf David DeWolf added a comment - Thanks!!!! SVN Commit 503316.
        Hide
        dhay David Hay added a comment -

        getContextPath should probably look like this:

        public String getContextPath() {
        String contextPath = this.internalPortletWindow.getContextPath();
        if ("/".equals(contextPath))

        { contextPath = ""; }

        return contextPath;
        }

        Show
        dhay David Hay added a comment - getContextPath should probably look like this: public String getContextPath() { String contextPath = this.internalPortletWindow.getContextPath(); if ("/".equals(contextPath)) { contextPath = ""; } return contextPath; }

          People

          • Assignee:
            ddewolf David DeWolf
            Reporter:
            dhay David Hay
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development