code: public static boolean isPortletEnvSupported() {
          if (enabled == null) {
              synchronized (PortletSupport.class) {
                  if (enabled == null) {
                      try {
                          PortletSupport.class.getClassLoader().loadClass("javax.portlet.PortletContext");
                          enabled = true;
                      } catch (Throwable ignored) {
                          enabled = false;
                      }
                  }
              }
          }
          return enabled;
      }
docs: Is portlet env supported.
  
  @return true if portlet env is supported, false otherwise