code: @Override
      public RequestCtx handleResponse(HttpServletRequest request,
                                       HttpServletResponse response)
              throws IOException, ServletException {
          if (request.getParameter("terms") == null
                  && request.getParameter("query") == null
                  && request.getParameter("sessionToken") == null) {
              return null;
          }
  
          DataResponseWrapper res = (DataResponseWrapper) response;
          byte[] data = res.getData();
  
          byte[] result = null;
          String body = new String(data);
  
          if (body.startsWith("<html>")) {
              logger.debug("filtering html");
              result = filterHTML(request, res);
          } else if (body.startsWith("<?xml")) {
              logger.debug("filtering xml");
              result = filterXML(request, res);
          } else {
              logger.debug("not filtering due to unexpected output: {}", body);
              result = data;
          }
  
          res.setData(result);
  
          return null;
      }
docs: /*
  (non-Javadoc)
  @see
  org.fcrepo.server.security.xacml.pep.rest.filters.RESTFilter#handleResponse(javax.servlet
  .http.HttpServletRequest, javax.servlet.http.HttpServletResponse)