/** {@inheritDoc} */ public InputStream applyFilter(InputStream resource) throws ResourceException { if (resourceFilters == null || resourceFilters.isEmpty()) { log.debug("No resource filters configured, nothing to do"); return resource; } for (ResourceFilter filter : resourceFilters) { log.debug("Applying filter '{}'", filter.getClass().getName()); resource = filter.applyFilter(resource); } return resource; } }
/** * Applies the filter to the given stream resulting in the returned stream. If no filter is set than the given * stream is the returned stream. * * @param stream the stream to filter * * @return the filtered stream * * @throws ResourceException thrown if the filter can not be applied to the stream */ protected InputStream applyFilter(InputStream stream) throws ResourceException { ResourceFilter filter = getResourceFilter(); if (filter != null) { log.debug("Apply filter '{}' to resource '{}'", filter.getClass(), this.getLocation()); return getResourceFilter().applyFilter(stream); } else { return stream; } } }