Single JS/CSS resources should be able to concatenate with themselves. This behavior should be similar to ProxyingVisitor proxying single JS/CSS resources.
This will be useful in cases when ScriptConcatContentRewriter and/or StyleConcatContentRewriter are used along with ProxyingContentRewriter (without the ConcatVisitors and not proxying JS/CSS)
Neat cl :) Took a quick look at it and the code looks nice. Just ...
15 years, 4 months ago
(2010-09-13 09:54:57 UTC)
#1
Neat cl :)
Took a quick look at it and the code looks nice. Just wondering if we need to
add another param to Config, but from first impression its the right change to
make.
Will take another look later.
small nitpicks related to tests. Will commit once you address these http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java (right): ...
15 years, 3 months ago
(2010-10-03 19:17:28 UTC)
#5
small nitpicks related to tests.
Will commit once you address these
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/main/java/or...
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java
(right):
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/main/java/or...
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java:138:
@Named("shindig.content-rewrite.enable-single-resource-concat")boolean
enableSingleResourceConcatenation) {
line length
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
File
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java
(right):
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:132:
assertEquals(VisitStatus.BYPASS, getVisitStatusJs(js1, null, false, false));
You could create another method which takes the singleResourceConcat parameter,
while keeping the current getVisitStatusJs() method signature as is [ implicit
singleResourceConcat = false ] That way the diffs would be fewer.
But your approach makes things clearer, so its okay if you feel against the 2
method approach.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:228:
assertEquals(VisitStatus.RESERVE_NODE, getVisitStatusCss(node, null, true));
this should ideally be moved out to another test case, something like:
visitCssSeperatedByNonEmptyTextNodeWhenSingleConcatEnabled
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:232:
public void dontVisitRelFreeCss() throws Exception {
I know this is not related to this codereview, but could you also rename this
method to:
dontVisitCssWithoutRelAttribute
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:240:
public void dontVisitTypeCssFreeCss() throws Exception {
I know this is not related to this codereview, but could you also rename this
method to
dontVisitCssWithoutTypeAttribute.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:265:
Node node = elem("link", "href", CSS1_URL_STR);
This test is kind of redundant as we have tested that css is ignored when either
the type or rel attribute is missing (we have covered both code paths so this
one is kind of implied)
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:324:
assertEquals(CONCAT_BASE_URI.getScheme(), concatUri.getScheme());
you could check the entire thing in 1 shot, it would be more readable as well:
assertEquals("//blah/gadgets/concat?1= ..." , concatUri.toString())
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:370:
Uri concatUri = Uri.parse(concatNode.getAttribute("href"));
same comment as above.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:495:
List<Node> fullListJs = Lists.newArrayList();
You can make this a 1 liner:
List<Node> jsList = ImmutableList.of(seqNodes(js1, js2), seqNodes(js3));
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:512:
assertEquals(CONCAT_BASE_URI.getScheme(), concatUri1.getScheme());
something like:
assertEquals("//example.org/gadgets/concat?1=..&2=..&...", concatUri.toString())
might be more readable.
Btw, why is the & to & conversion still required ? I though Ziv moved the
escaping code out of ConcatVisitor.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:824:
private VisitStatus getVisitStatusJs(Node node, String rewriteRegex, boolean
splitJs, boolean singleResouce)
line length
15 years, 3 months ago
(2010-10-04 08:50:15 UTC)
#6
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/main/java/or...
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java
(right):
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/main/java/or...
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ContentRewriterFeature.java:138:
@Named("shindig.content-rewrite.enable-single-resource-concat")boolean
enableSingleResourceConcatenation) {
On 2010/10/03 19:17:28, gagan.goku wrote:
> line length
Done.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
File
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java
(right):
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:132:
assertEquals(VisitStatus.BYPASS, getVisitStatusJs(js1, null, false, false));
On 2010/10/03 19:17:28, gagan.goku wrote:
> You could create another method which takes the singleResourceConcat
parameter,
> while keeping the current getVisitStatusJs() method signature as is [ implicit
> singleResourceConcat = false ] That way the diffs would be fewer.
>
> But your approach makes things clearer, so its okay if you feel against the 2
> method approach.
I can use the existing tests to verify all the scenarios if I use the same
method.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:228:
assertEquals(VisitStatus.RESERVE_NODE, getVisitStatusCss(node, null, true));
On 2010/10/03 19:17:28, gagan.goku wrote:
> this should ideally be moved out to another test case, something like:
> visitCssSeperatedByNonEmptyTextNodeWhenSingleConcatEnabled
Done.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:232:
public void dontVisitRelFreeCss() throws Exception {
On 2010/10/03 19:17:28, gagan.goku wrote:
> I know this is not related to this codereview, but could you also rename this
> method to:
> dontVisitCssWithoutRelAttribute
CssWithoutRelAttribute is same as RelFreeCss.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:240:
public void dontVisitTypeCssFreeCss() throws Exception {
On 2010/10/03 19:17:28, gagan.goku wrote:
> I know this is not related to this codereview, but could you also rename this
> method to
> dontVisitCssWithoutTypeAttribute.
CssWithoutTypeAttribute is same as TypeCssFreeCss
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:265:
Node node = elem("link", "href", CSS1_URL_STR);
On 2010/10/03 19:17:28, gagan.goku wrote:
> This test is kind of redundant as we have tested that css is ignored when
either
> the type or rel attribute is missing (we have covered both code paths so this
> one is kind of implied)
Maybe to verify its not an XOR :)
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:324:
assertEquals(CONCAT_BASE_URI.getScheme(), concatUri.getScheme());
On 2010/10/03 19:17:28, gagan.goku wrote:
> you could check the entire thing in 1 shot, it would be more readable as well:
> assertEquals("//blah/gadgets/concat?1= ..." , concatUri.toString())
It is good to split and check like they have done in existing tests, esp for
concat uris which are big and would have to be constructed the same way
CONCAT_BASE_URI.getScheme() + getAuthorigy() + ...
So, splitting it up is better as it saves all this computation, plus gives
exactly what is wrong.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:495:
List<Node> fullListJs = Lists.newArrayList();
On 2010/10/03 19:17:28, gagan.goku wrote:
> You can make this a 1 liner:
> List<Node> jsList = ImmutableList.of(seqNodes(js1, js2), seqNodes(js3));
Needs a list and not ImmutableList
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:512:
assertEquals(CONCAT_BASE_URI.getScheme(), concatUri1.getScheme());
On 2010/10/03 19:17:28, gagan.goku wrote:
> something like:
> assertEquals("//example.org/gadgets/concat?1=..&2=..&...",
concatUri.toString())
> might be more readable.
>
> Btw, why is the & to & conversion still required ? I though Ziv moved the
> escaping code out of ConcatVisitor.
Removed the & changed, I seem to have missed this one.
http://codereview.appspot.com/2164045/diff/7001/java/gadgets/src/test/java/or...
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/ConcatVisitorTest.java:824:
private VisitStatus getVisitStatusJs(Node node, String rewriteRegex, boolean
splitJs, boolean singleResouce)
On 2010/10/03 19:17:28, gagan.goku wrote:
> line length
Done.
Done. On Fri, Oct 8, 2010 at 11:03 PM, <gagan.goku@gmail.com> wrote: > On 2010/10/08 16:53:34, ...
15 years, 3 months ago
(2010-10-08 18:29:01 UTC)
#10
Done.
On Fri, Oct 8, 2010 at 11:03 PM, <gagan.goku@gmail.com> wrote:
> On 2010/10/08 16:53:34, gagan.goku wrote:
>
>> LGTM. Will commit shortly.
>>
>
> Too many merge failures :( Please svn up and reupload patch.
>
>
> http://codereview.appspot.com/2164045/
>
Issue 2164045: Enabling single resource concatenation
(Closed)
Created 15 years, 4 months ago by Kuntal Loya
Modified 15 years, 3 months ago
Reviewers: dev_shindig.apache.org, rev-remailer_shindig.apache.org, Paul Lindner, gagan.goku
Base URL: http://svn.apache.org/repos/asf/shindig/trunk/
Comments: 27