@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof HttpRequest)) { return false; } HttpRequest req = (HttpRequest) obj; return super.equals(obj) && req.getCacheTtl() == getCacheTtl() && req.getIgnoreCache() == getIgnoreCache(); }
/** Sanitize a CSS file. */ private boolean rewriteProxiedCss( HttpRequest request, HttpResponse response, MutableContent content, ContentRewriterFeature rewriterFeature) { String sanitized = ""; try { String contentType = response.getHeader("Content-Type"); if (contentType == null || contentType.toLowerCase().startsWith("text/")) { SanitizingProxyingLinkRewriter cssImportRewriter = sanitizingProxyingLinkRewriterFactory.create( request.getGadget(), rewriterFeature, request.getContainer(), "text/css", false, request.getIgnoreCache()); SanitizingProxyingLinkRewriter cssImageRewriter = sanitizingProxyingLinkRewriterFactory.create( request.getGadget(), rewriterFeature, request.getContainer(), "image/*", false, request.getIgnoreCache()); sanitized = cssSanitizer.sanitize( content.getContent(), request.getUri(), cssImportRewriter, cssImageRewriter); } return true; } finally { // Set sanitized content in finally to ensure it is always cleared in // the case of errors content.setContent(sanitized); } }