code: protected static boolean isResourceSubscribed(
          CmsObject cms,
          String fileName,
          boolean subFolder,
          CmsUser user,
          List<CmsGroup> groups,
          HttpServletRequest req) throws CmsException {
  
          CmsResource checkResource = cms.readResource(fileName);
  
          HttpSession session = req.getSession(true);
          String sessionKey = generateSessionKey(SESSION_PREFIX_SUBSCRIBED, fileName, subFolder, user, groups);
          // try to get the subscribed resources from a session attribute
          @SuppressWarnings("unchecked")
          List<CmsResource> subscribedResources = (List<CmsResource>)session.getAttribute(sessionKey);
          if (subscribedResources == null) {
              // first call, read subscribed resources and store them to session attribute
              CmsSubscriptionFilter filter = new CmsSubscriptionFilter();
              filter.setParentPath(CmsResource.getFolderPath(checkResource.getRootPath()));
              filter.setIncludeSubfolders(subFolder);
              filter.setUser(user);
              filter.setGroups(groups);
              filter.setMode(CmsSubscriptionReadMode.ALL);
              subscribedResources = OpenCms.getSubscriptionManager().readSubscribedResources(cms, filter);
              session.setAttribute(sessionKey, subscribedResources);
          }
          return subscribedResources.contains(checkResource);
      }
docs: Returns if the given resource is subscribed to the user or groups.<p>
  
  @param cms the current users context
  @param fileName the file name to track
  @param subFolder flag indicating if sub folders should be included
  @param user the user that should be used for the check
  @param groups the groups that should be used for the check
  @param req the current request
  
  @return <code>true</code> if the given resource is subscribed to the user or groups, otherwise <code>false</code>
  
  @throws CmsException if something goes wrong