We should add some tests to this at some point as well.


http://codereview.appspot.com/129072/diff/22/1001
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/CajaContentRewriter.java
(right):

http://codereview.appspot.com/129072/diff/22/1001#newcode72
Line 72: System.err.println("Cajoled cache created" + cajoledCache);
use logger please ;)

http://codereview.appspot.com/129072/diff/22/1001#newcode114
Line 114: String key =
HashUtil.rawChecksum(content.getContent().getBytes());
Two comments on selection of key:
1) can you augment DocumentGadgetRewriter to compute one from its input,
augmenting during the rewriting pass? that avoids the
serialization/deserialization set you're doing here.
2) DGR could/should also include some notion of Caja version in its key
computation, to avoid stale entries in the event that CacheProvider
might offer a distributed cache.

http://codereview.appspot.com/129072/diff/22/1001#newcode124
Line 124: HtmlSerialization.attach(doc, new CajaHtmlSerializer(), null);
nit: you could pull these 3 lines into a helper method referenced here
and below.

http://codereview.appspot.com/129072/diff/22/1001#newcode143
Line 143: cajoledOutput.setAttribute("style", "position: relative;");
curious, why doesn't rewriteContent do this boilerplate, even as a
helper method (eg. wrapInContainer or something)?

http://codereview.appspot.com/129072/diff/22/1001#newcode152
Line 152: createContainerFor(doc, cajoledOutput);
nit: could you rename this "createIframeDocumentFor" for clarity?

http://codereview.appspot.com/129072

Reply via email to