Uploaded image for project: 'Jetspeed 2 (Retired)'
  1. Jetspeed 2 (Retired)
  2. JS2-660

Request attribute not available in jsp when using the JetspeedPowerTool

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.2
    • 2.1.2
    • Aggregation
    • None

    Description

      The request attributes set in a portlet are not available inside a jsp after an "include" when the portlet is inserted in the header.vm with JetspeedPowerTool.

      For example I have the foolowing code in a portlet doView :
      request.setAttribute("test", "hello");
      getPortletContext().getRequestDispatcher("/test.jsp").include(request, response);

      test.jsp contains :
      ${test}

      And in header.vm :
      $jetspeed.renderPortletEntity("testportlet", "portlets::TestPortlet")

      The value of attribute "test" is not visible. It works fine if the portlet is included in a psml.

      I suggest the following correction in the class org.apache.jetspeed.engine.servlet.ServletRequestImpl, in the method getAttribute(String) :

      Replace :

      public Object getAttribute( String name )
      {
      Object value = null;

      // In parallel mode, first look up from the worker.

      Thread ct = Thread.currentThread();

      if (ct instanceof Worker)

      { value = CurrentWorkerContext.getAttribute(name); }

      ...

      With :

      public Object getAttribute( String name )
      {
      Object value = null;

      // In parallel mode, first look up from the worker.

      Thread ct = Thread.currentThread();

      if (ct instanceof Worker)
      {
      value = CurrentWorkerContext.getAttribute(name);
      if (null == value)
      {
      PortletRequest pr = (PortletRequest) super.getAttribute("javax.portlet.request");
      if (pr != null)

      { value = CurrentWorkerContext.getAttribute(nameSpaceMapper.encode(portletWindow.getId(), name)); }

      }
      }
      ....

      Attachments

        Activity

          People

            taylor David Sean Taylor
            nicolas.dutertry Nicolas Dutertry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: