Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-73640

Customized Struts Action not applied after restart: StrutsActionRegistryUtil should use ServiceTrackerMap

    Details

      Description

      Steps to Reproduce - 70x

      1. Start portal
      2. Create and deploy a custom module which customizes one of our portal StrutsAction (find attached), for example
        package com.test
        
        import com.liferay.portal.comment.action.EditDiscussionStrutsAction;
        import com.liferay.portal.kernel.log.Log;
        import com.liferay.portal.kernel.log.LogFactoryUtil;
        import com.liferay.portal.kernel.struts.StrutsAction;
        import org.osgi.service.component.annotations.Component;
        
        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;
        
        
        @Component(
        		immediate = true,
        		property = {
        			"path=/portal/comment/edit_discussion"
        		},
        		service = StrutsAction.class)
        public class CustomEditDiscussionAction extends EditDiscussionStrutsAction {
        
        	/** Defines the logger instance. */
        	private static final Log _log = LogFactoryUtil.getLog(CustomEditDiscussionAction.class);
        
        	@Override
        	public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
        		_log.info("CustomEditDiscussionAction.execute()");
        
        		return super.execute(request, response);
        	}
        }
        

        Note: this example no longer applicable for master as "comment/edit_discussion" StrutsAction has been modularized into "collaboration/comment/comment-taglib".

      3. Add "Page Comments" to a page
      4. Post a comment
        Result: "CustomEditDiscussionAction.execute()" is printed in the log
      5. Restart the portal
      6. Comment again
        Result: No message in the log, custom action is not executed

      Workaround: Modify component annotation and use "server.ranking":

      @Component(
      		immediate = true,
      		property = {
      			"path=/portal/comment/edit_discussion",
      			"service.ranking:Integer=-1"
      		},
      		service = StrutsAction.class)
      

      Technical Background
      StrutsActionRegistryUtil should use ServiceTrackerMap

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 47 weeks, 1 day ago

                  Packages

                  Version Package
                  7.0.0 DXP FP33
                  7.0.0 DXP FP35
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.0.X
                  7.1.0 M1
                  7.1.X
                  Master