code: public List<CmsResource> readCategoryResources(
          CmsObject cms,
          String categoryPath,
          boolean recursive,
          String referencePath,
          CmsResourceFilter resFilter)
      throws CmsException {
  
          Set<CmsResource> resources = new HashSet<CmsResource>();
          CmsRelationFilter filter = CmsRelationFilter.SOURCES.filterType(CmsRelationType.CATEGORY);
          if (recursive) {
              filter = filter.filterIncludeChildren();
          }
          CmsCategory category = readCategory(cms, categoryPath, referencePath);
          Iterator<CmsRelation> itRelations = cms.getRelationsForResource(
              cms.getRequestContext().removeSiteRoot(category.getRootPath()),
              filter).iterator();
          while (itRelations.hasNext()) {
              CmsRelation relation = itRelations.next();
              try {
                  resources.add(relation.getSource(cms, resFilter));
              } catch (CmsException e) {
                  // source does not match the filter
                  if (LOG.isDebugEnabled()) {
                      LOG.debug(e.getLocalizedMessage(), e);
                  }
              }
          }
          List<CmsResource> result = new ArrayList<CmsResource>(resources);
          Collections.sort(result);
          return result;
      }
docs: Reads the resources for a category identified by the given category path.<p>
  
  @param cms the current cms context
  @param categoryPath the path of the category to read the resources for
  @param recursive <code>true</code> if including sub-categories
  @param referencePath the reference path to find all the category repositories
  @param resFilter the resource filter to use
  
  @return a list of {@link CmsResource} objects
  
  @throws CmsException if something goes wrong