code: protected static boolean isResourceVisited(
          CmsObject cms,
          String fileName,
          boolean subFolder,
          CmsUser user,
          HttpServletRequest req) throws CmsException {
  
          CmsResource checkResource = cms.readResource(fileName);
  
          HttpSession session = req.getSession(true);
          String sessionKey = generateSessionKey(SESSION_PREFIX_VISITED, fileName, subFolder, user, null);
          // try to get the visited resources from a session attribute
          @SuppressWarnings("unchecked")
          List<CmsResource> visitedResources = (List<CmsResource>)req.getSession(true).getAttribute(sessionKey);
          if (visitedResources == null) {
              // first call, read visited resources and store them to session attribute
              CmsVisitedByFilter filter = new CmsVisitedByFilter();
              filter.setUser(user);
              filter.setParentPath(CmsResource.getFolderPath(checkResource.getRootPath()));
              filter.setIncludeSubfolders(subFolder);
              visitedResources = OpenCms.getSubscriptionManager().readResourcesVisitedBy(cms, filter);
              session.setAttribute(sessionKey, visitedResources);
          }
  
          return visitedResources.contains(checkResource);
      }
docs: Returns if the given resource was visited by the user.<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 req the current request
  
  @return <code>true</code> if the given resource was visited by the user, otherwise <code>false</code>
  
  @throws CmsException if something goes wrong