2 Replies Latest reply on Oct 4, 2012 12:45 AM by kasq

    Determine if Author or Publish Instance

    Jayatl Level 1

      Hello,

       

      I want to check whether my component is running under an Author or publish instance and do something different based on the result.  The CQ4 instructions here don't seem to work under 5.5.  Is there an updated method of checking the instance?

       

      Suggestion from link:

       

      DeliveryHttpServletRequest cqRequest = (DeliveryHttpServletRequest) request;
      
      // flag to indicate whether instance is Author or Publish
      boolean isAuthor = !cqRequest.getCmsService().getDisplayControlSet(cqRequest).equals(DisplayControlSet.SHOW);
      
      // flag to indicate whether instance is in preview/show mode
      boolean isShowMode = (cqRequest.getCmsService().getDisplayControlSet(cqRequest).equals(DisplayControlSet.SHOWMODE)
      || "ShowMode".equals(cqRequest.getParameter("Show")) );
      
      

       

      Thanks