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

PortletWindowConfig#createPortletId generates troublesome id with leading slash



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: portal driver
    • Labels:


      PortletWindowConfig#createPortletId uses the context as the beginning of the ID, but leaves the leading slash on if it exists. This is troublesome for parsing to resultant portlet id from urls (for example with Wicket portlet support). The reason to avoid '/' in the portlet id is so that you can discover the portlet id, by simply looking between two slashes.
      I propose the following:

              String trimContextPath = null;
      		if (contextPath.startsWith("/"))
      			trimContextPath = contextPath.substring(1);
      			trimContextPath = contextPath;
      		return trimContextPath + "." + portletName + "!" + metaInfo;

      Is the a reason why the leading slash should be kept for portlet ids?

      After further investigation, this doesn't seem to be where the portlet id is actually generated.
      However, it does seem to do. I'm afraid of the inconsistencies this change may introduce though.

      However, there seems to be a circular sort of dependency (which is why i thought it wasn't generated there), as some code relies on being able to extract the context path from the portal ID, so I also added this:

      public static String parseContextPath(String portletId) {
      int index = getSeparatorIndex(portletId);
      String context = portletId.substring(0, index);
      if (!context.startsWith("/"))

      { context = "/" + context; }

      return context;

      this makes sure that the context path always starts with a / as is required by the servlet context look-up functions.

      So to sum it up, this removes the / from the beginning of the portlet id, so the wicket portal urls end up looking like:
      instead of:

      which appears to work with the current wicket/portal implementation, as it looks for the portlet id between the two /'s.

      nb of course that this may effect other portal web frameworks as well.




            • Assignee:
              ate Ate Douma
              astubbs Antony Stubbs
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: