Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(204)

Issue 1689055: Rewrite html content in DomWalker.Rewriter only if builder.getContent() is nonempty (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 7 months ago by gagan.goku
Modified:
15 years, 7 months ago
Reviewers:
johnfargo, zhoresh, dev-remailer
CC:
cool-shindig-committers_googlegroups.com, anupama.dutta
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

For pages which return status code 200 and content type text/html but no content, we throw an exception in the parser and then this exception goes all the way to proxy servlet. We should not even attempt to rewrite something using DomWalker if the original content itself is empty.

Patch Set 1 #

Total comments: 2

Patch Set 2 : 'adding_test' #

Patch Set 3 : 'reverting_unnecessary_files' #

Patch Set 4 : 'reverting_unnecessary_files' #

Total comments: 2

Patch Set 5 : 'updating_test' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -1 line) Patch
M java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java View 1 2 3 4 2 chunks +2 lines, -1 line 1 comment Download
M java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/DomWalkerTest.java View 2 3 4 2 chunks +18 lines, -0 lines 0 comments Download

Messages

Total messages: 10
anupama.dutta
http://codereview.appspot.com/1689055/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java (right): http://codereview.appspot.com/1689055/diff/1/2#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java:141: if (RewriterUtils.isHtml(request, builder) && !StringUtils.isEmpty(builder.getContent())) { Please add a ...
15 years, 7 months ago (2010-07-30 10:18:31 UTC) #1
gagan.goku
http://codereview.appspot.com/1689055/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java (right): http://codereview.appspot.com/1689055/diff/1/2#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java:141: if (RewriterUtils.isHtml(request, builder) && !StringUtils.isEmpty(builder.getContent())) { On 2010/07/30 10:18:31, ...
15 years, 7 months ago (2010-07-31 11:26:58 UTC) #2
anupama.dutta
LGTM. Please send to dev.remailer for review + commit.
15 years, 7 months ago (2010-08-02 13:25:32 UTC) #3
zhoresh
LGTM, but please update the test. Thanks http://codereview.appspot.com/1689055/diff/8001/9001 File java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/DomWalkerTest.java (right): http://codereview.appspot.com/1689055/diff/8001/9001#newcode272 java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/DomWalkerTest.java:272: DomWalker.Rewriter rewriter ...
15 years, 7 months ago (2010-08-02 17:37:18 UTC) #4
gagan.goku
http://codereview.appspot.com/1689055/diff/8001/9001 File java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/DomWalkerTest.java (right): http://codereview.appspot.com/1689055/diff/8001/9001#newcode272 java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/DomWalkerTest.java:272: DomWalker.Rewriter rewriter = getRewriter(); On 2010/08/02 17:37:18, zhoresh wrote: ...
15 years, 7 months ago (2010-08-02 18:06:23 UTC) #5
zhoresh
Thanks for updating the test, LGTM, committed (r981658)
15 years, 7 months ago (2010-08-02 18:49:35 UTC) #6
gagan.goku
Thanks Ziv. Gagan -- The only thing missing in life is background music. -- Gagandeep ...
15 years, 7 months ago (2010-08-02 19:29:15 UTC) #7
johnfargo
Just noticed this was committed -- rollback w/ alternate solution in the following (also committed): ...
15 years, 7 months ago (2010-08-02 23:06:12 UTC) #8
gagan.goku
On 2010/08/02 23:06:12, johnfargo wrote: > Just noticed this was committed -- rollback w/ alternate ...
15 years, 7 months ago (2010-08-03 04:01:31 UTC) #9
johnfargo
15 years, 7 months ago (2010-08-03 09:33:47 UTC) #10
Irrespective the patch, or even which registry it should go into, what was
the specific Exception that was thrown?


Cheers,
John

On Mon, Aug 2, 2010 at 9:01 PM, <gagan.goku@gmail.com> wrote:

> On 2010/08/02 23:06:12, johnfargo wrote:
>
>> Just noticed this was committed -- rollback w/ alternate solution in
>>
> the
>
>> following (also committed):
>> http://codereview.appspot.com/1902046/show
>>
>
>  Comments welcome.
>>
>
>  http://codereview.appspot.com/1689055/diff/13001/11003
>> File
>>
>
>
> java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java
>
>> (right):
>>
>
>  http://codereview.appspot.com/1689055/diff/13001/11003#newcode143
>>
>
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java:143:
>
>> if (RewriterUtils.isHtml(request, builder) &&
>> !StringUtils.isEmpty(builder.getContent())) {
>> sadly this change is very problematic from a performance perspective.
>>
>
>  Every DomWalker-based rewriter does a getDocument(), which does a DOM
>>
> parse.
>
>> This parse is cached until getContent() is called, at which time the
>>
> content is
>
>> re-serialized. The cycle will return for every rewriter, leading to N
>>
> re-parses
>
>> per rendering pass, where N = number of rewriters.
>>
>
>  I'd recommend putting this logic in AccelResponseRewriterRegistry,
>>
> where doing a
>
>> getContent() check is harmless since subsequent rewriters are likely
>>
> to make
>
>> that call anyway, which by that time will be cached.
>>
>
> Hi John
>
> Comment well taken. Making the change in AccelResponseRegistry is fine,
> except the original exception occured while proxying a resource. This
> change would be more suited in DefaultResponseRewriterRegistry.
>
>
>
> http://codereview.appspot.com/1689055/show
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b