Pluto
  1. Pluto
  2. PLUTO-328

Add support for a callback right before Render and Action in PortletServlet

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.1.2
    • Component/s: portlet container
    • Labels:
      None

      Description

      Basically we need another Optional service that provides a user of Pluto's container (like Sakai) with the opportunity to adjust things right before Action and Render is called.

      In Sakai's case the use case is that we need to put a few items (context) into thread local on every request so that the entire suite of Sakai APIs works in portlets.

      For Sakai tools, this is done with a Request Filter - but for Pluto I do not want to add anything like a filter because I want to maintain 100% binary compatibility of war files between Sakai and all other Pluto 1.1 based implementations - so for me an answer that says "just hack the web.xml and add your filter" is not acceptible.

      I am already working on this and have complete but untested code. Once everything tests out, I will post a patch. Here is the basic idea (imitating the ADMIN listener):

      +public interface PortletPrepareListener

      { + + void preRender(PortletRequest request, PortletResponse response); + + void preAction(PortletRequest request, PortletResponse response); + +}

      I use Exactly the same pattern as the ADMIN listener. I decided one listener with two methods was better than two listeners.

      And frankly - people smarter than me migh actually decide to refactor this and call our new friend the "PortletServletListener" and have three mentods (admin, preRender, and preAction).

      Once I hand in my patch - I am happt to see the refactor happen - based on what folks think.

        Activity

        Charles Severance created issue -
        David DeWolf made changes -
        Field Original Value New Value
        Fix Version/s 1.2.0 [ 12312213 ]
        Assignee David DeWolf [ ddewolf ]
        Fix Version/s 1.1.1 [ 12312224 ]
        Hide
        Charles Severance added a comment -

        I have my patch attached as a file. it is to be applied to trunk.

        Show
        Charles Severance added a comment - I have my patch attached as a file. it is to be applied to trunk.
        Hide
        Charles Severance added a comment -

        I refactored and called this "PortletServletService" because it really is a helper for the PortletServlet.

        Show
        Charles Severance added a comment - I refactored and called this "PortletServletService" because it really is a helper for the PortletServlet.
        Charles Severance made changes -
        Attachment pluto-csev-patch-PLUTO-328.txt [ 12352567 ]
        David DeWolf made changes -
        Fix Version/s 1.2.0 [ 12312213 ]
        Affects Version/s 1.1.0 [ 12310687 ]
        Affects Version/s 1.1.1 [ 12312224 ]
        Fix Version/s 1.1.2 [ 12312360 ]
        Hide
        David DeWolf added a comment -

        I like this. Thanks for the patch. I'm going to make two changes:

        1) Use an event object to encapsulate event info. This will allow us to more easily provide backwards compatibility as we add additional methods (for instance when we need to include eventing invocations in 286). It will also allow portals to use the same listener method for multiple types if they desire.

        2) Revert back to PortalAdministrationService because this talks about WHAT it does rather than HOW it does it. At some point I wouldn't be shocked if we don't have a Servlet for invocation but have a Filter or perhaps even another method that doesn't use cross context dispatching (way in the future, don't get excited). This will prevent us from having to rename these in those situations.

        Show
        David DeWolf added a comment - I like this. Thanks for the patch. I'm going to make two changes: 1) Use an event object to encapsulate event info. This will allow us to more easily provide backwards compatibility as we add additional methods (for instance when we need to include eventing invocations in 286). It will also allow portals to use the same listener method for multiple types if they desire. 2) Revert back to PortalAdministrationService because this talks about WHAT it does rather than HOW it does it. At some point I wouldn't be shocked if we don't have a Servlet for invocation but have a Filter or perhaps even another method that doesn't use cross context dispatching (way in the future, don't get excited). This will prevent us from having to rename these in those situations.
        Hide
        David DeWolf added a comment -

        Added. Give it a try and let me know what you think.

        Show
        David DeWolf added a comment - Added. Give it a try and let me know what you think.
        David DeWolf made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Charles Severance added a comment -

        I took a quick look and your approach indeed does look far nicer and more general than my approach. Once I get Sakai safely up to Pluto 1.1.1 and checked in - I will jump to and refactor the Sakai code to use the new approach for 1.1.2.

        Show
        Charles Severance added a comment - I took a quick look and your approach indeed does look far nicer and more general than my approach. Once I get Sakai safely up to Pluto 1.1.1 and checked in - I will jump to and refactor the Sakai code to use the new approach for 1.1.2.
        Elliot Metsger made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12398693 ] Default workflow, editable Closed status [ 12565290 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12565290 ] jira [ 12586066 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1d 7h 16m 1 David DeWolf 06/Mar/07 02:02
        Resolved Resolved Closed Closed
        14d 21h 30m 1 Elliot Metsger 20/Mar/07 23:32

          People

          • Assignee:
            David DeWolf
            Reporter:
            Charles Severance
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development