private String rewrite(HttpRequest request, HttpResponse response) throws Exception { request.setSanitizationRequested(true); ResponseRewriter rewriter = createRewriter(Collections.<String>emptySet(), Collections.<String>emptySet()); HttpResponseBuilder hrb = new HttpResponseBuilder(parser, response); rewriter.rewrite(request, hrb); if (hrb.getNumChanges() == 0) { return null; } return hrb.getContent(); }
private String rewrite(HttpRequest request, HttpResponse response, Gadget gadget) throws Exception { request.setSanitizationRequested(true); ResponseRewriter rewriter = createRewriter(Collections.<String>emptySet(), Collections.<String>emptySet()); HttpResponseBuilder hrb = new HttpResponseBuilder(parser, response); rewriter.rewrite(request, hrb, gadget); if (hrb.getNumChanges() == 0) { return null; } return hrb.getContent(); }
private String rewrite(HttpRequest request, HttpResponse response, Gadget gadget) throws Exception { request.setSanitizationRequested(true); ResponseRewriter rewriter = createRewriter(Collections.<String>emptySet(), Collections.<String>emptySet()); HttpResponseBuilder hrb = new HttpResponseBuilder(parser, response); rewriter.rewrite(request, hrb, gadget); if (hrb.getNumChanges() == 0) { return null; } return hrb.getContent(); }
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 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 String rewrite(HttpRequest request, HttpResponse response) throws Exception { request.setSanitizationRequested(true); ResponseRewriter rewriter = createRewriter(); HttpResponseBuilder hrb = new HttpResponseBuilder(parser, response); rewriter.rewrite(request, hrb); return hrb.getContent(); }
req.setSanitizationRequested(httpApiRequest.sanitize);
req.setSanitizationRequested(httpApiRequest.sanitize);
req.setSanitizationRequested(httpApiRequest.sanitize);
public HttpRequest makeHttpRequest(Uri targetUri) throws GadgetException { HttpRequest req = new HttpRequest(targetUri) .setIgnoreCache(isNoCache()) .setContainer(getContainer()); if (!StringUtils.isEmpty(getGadget())) { try { req.setGadget(Uri.parse(getGadget())); } catch (IllegalArgumentException e) { throw new GadgetException(GadgetException.Code.INVALID_PARAMETER, "Invalid " + Param.GADGET.getKey() + " param: " + getGadget(), HttpResponse.SC_BAD_REQUEST); } } if (getRefresh() != null && getRefresh() >= 0) { req.setCacheTtl(getRefresh()); } // Allow the rewriter to use an externally forced MIME type. This is needed // allows proper rewriting of <script src="x"/> where x is returned with // a content type like text/html which unfortunately happens all too often if (rewriteMimeType != null) { req.setRewriteMimeType(getRewriteMimeType()); } req.setSanitizationRequested(sanitizeContent()); req.setCajaRequested(cajoleContent()); return req; }
public HttpRequest makeHttpRequest(Uri targetUri) throws GadgetException { HttpRequest req = new HttpRequest(targetUri) .setIgnoreCache(isNoCache()) .setContainer(getContainer()); if (!StringUtils.isEmpty(getGadget())) { try { req.setGadget(Uri.parse(getGadget())); } catch (IllegalArgumentException e) { throw new GadgetException(GadgetException.Code.INVALID_PARAMETER, "Invalid " + Param.GADGET.getKey() + " param: " + getGadget(), HttpResponse.SC_BAD_REQUEST); } } if (getRefresh() != null && getRefresh() >= 0) { req.setCacheTtl(getRefresh()); } // Allow the rewriter to use an externally forced MIME type. This is needed // allows proper rewriting of <script src="x"/> where x is returned with // a content type like text/html which unfortunately happens all too often if (rewriteMimeType != null) { req.setRewriteMimeType(getRewriteMimeType()); } req.setSanitizationRequested(sanitizeContent()); req.setCajaRequested(cajoleContent()); return req; }
public HttpRequest makeHttpRequest(Uri targetUri) throws GadgetException { HttpRequest req = new HttpRequest(targetUri) .setIgnoreCache(isNoCache()) .setContainer(getContainer()); if (!Strings.isNullOrEmpty(getGadget())) { try { req.setGadget(Uri.parse(getGadget())); } catch (IllegalArgumentException e) { throw new GadgetException(GadgetException.Code.INVALID_PARAMETER, "Invalid " + Param.GADGET.getKey() + " param: " + getGadget(), HttpResponse.SC_BAD_REQUEST); } } if (getRefresh() != null && getRefresh() >= 0) { req.setCacheTtl(getRefresh()); } // Allow the rewriter to use an externally forced MIME type. This is needed // allows proper rewriting of <script src="x"/> where x is returned with // a content type like text/html which unfortunately happens all too often if (rewriteMimeType != null) { req.setRewriteMimeType(getRewriteMimeType()); } req.setSanitizationRequested(sanitizeContent()); req.setCajaRequested(cajoleContent()); return req; }