private String rewrite(HttpRequest request, HttpResponse response, Gadget gadget) throws Exception {
request.setSanitizationRequested(true);
ResponseRewriter rewriter = createRewriter();
HttpResponseBuilder hrb = new HttpResponseBuilder(parser, response);
rewriter.rewrite(request, hrb, gadget);
return hrb.getContent();
}
private ResponseRewriter createRewriter() {
return new CajaResponseRewriter(new RequestPipeline() {