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

Issue 224094: Refactor ProxyingLinkRewriter into a Visitor (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 10 months ago by johnfargo
Modified:
15 years, 10 months ago
Reviewers:
zhoresh, shindig.remailer
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

This Visitor performs content-reference proxying, splitting logic off from HTMLContentRewriter. The logic is the same: upon matching a given supported tag with a Uri-type attribute, make the attribute's value a proxied version of itself. ProxyUriManager is used to perform the Uri operation. The implementation uses the DomWalker.Visitor pattern.

Patch Set 1 #

Patch Set 2 : Adding DomWalker test base class updates. #

Patch Set 3 : ...and the Content Reference Rewriter implementation using the new Visitor. #

Patch Set 4 : Synced to head. #

Total comments: 1

Patch Set 5 : Renamed ProxyingLinkRewriter to ProxyingVisitor to avoid conflation w/ previous classes. #

Patch Set 6 : Integration test stub, renaming for consistency. #

Total comments: 1

Messages

Total messages: 11
johnfargo
15 years, 10 months ago (2010-03-02 10:19:05 UTC) #1
johnfargo
Adding DomWalker test base class updates.
15 years, 10 months ago (2010-03-02 10:21:26 UTC) #2
johnfargo
...and the Content Reference Rewriter implementation using the new Visitor.
15 years, 10 months ago (2010-03-02 10:23:31 UTC) #3
johnfargo
Synced to head.
15 years, 10 months ago (2010-03-03 19:50:11 UTC) #4
zhoresh
LGTM http://codereview.appspot.com/224094/diff/2001/2002 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingLinkRewriter.java (left): http://codereview.appspot.com/224094/diff/2001/2002#oldcode67 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingLinkRewriter.java:67: result.append(rewriterFeature.getFingerprint()); There is no "fingerprint" in new code. ...
15 years, 10 months ago (2010-03-05 23:30:47 UTC) #5
johnfargo
On Fri, Mar 5, 2010 at 3:30 PM, <zhoresh@gmail.com> wrote: > LGTM > > > ...
15 years, 10 months ago (2010-03-08 22:37:30 UTC) #6
johnfargo
Renamed ProxyingLinkRewriter to ProxyingVisitor to avoid conflation w/ previous classes.
15 years, 10 months ago (2010-03-08 22:40:20 UTC) #7
johnfargo
Integration test stub, renaming for consistency.
15 years, 10 months ago (2010-03-09 01:33:32 UTC) #8
zhoresh
On 2010/03/09 01:33:32, johnfargo wrote: > Integration test stub, renaming for consistency. LGTM
15 years, 10 months ago (2010-03-09 02:07:55 UTC) #9
zhoresh
LGTM (Sorry previous mail didn't take comment...) http://codereview.appspot.com/224094/diff/16001/17004 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingContentRewriter.java (right): http://codereview.appspot.com/224094/diff/16001/17004#newcode32 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingContentRewriter.java:32: public class ...
15 years, 10 months ago (2010-03-09 02:08:37 UTC) #10
fargo
15 years, 10 months ago (2010-03-09 02:15:50 UTC) #11
Thanks again Ziv! Comments inline.

On Mon, Mar 8, 2010 at 6:08 PM, <zhoresh@gmail.com> wrote:

> LGTM
>
> (Sorry previous mail didn't take comment...)
>
>
> http://codereview.appspot.com/224094/diff/16001/17004
> File
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingContentRewriter.java
> (right):
>
> http://codereview.appspot.com/224094/diff/16001/17004#newcode32
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingContentRewriter.java:32:
> public class ProxyingContentRewriter extends DomWalker.Rewriter {
> Just a suggestions, there a repeated boiler plate code for multiple
> rewriters. Maybe it is possible to make it a generic that take in a
> visitor class and a uri manager?


I played around with this a bit but didn't find an especially clean way to
do it. The biggest pain is that ContentRewriterFeature.Config is created
per-request, so @Inject'ing it isn't quite so easy (without lots of
Guice-fu). A generic base class could be possible but would require (AFAICT)
either A) custom reflection/Guice-like code, or B) passing the Guice
injector through Gadget[Context] and/or HttpRequest.getAttribute(...), then
using that w/ a custom Module to create each Visitor.

Then again, there may be some much more clever way to handle this... but
I've not figured it out yet. Suggestions mas welcome.




>
>
> http://codereview.appspot.com/224094/show
>
Sign in to reply to this message.

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