org.apache.shindig.gadgets.rewrite
Class AbsolutePathReferenceVisitor

java.lang.Object
  extended by org.apache.shindig.gadgets.rewrite.AbsolutePathReferenceVisitor
All Implemented Interfaces:
DomWalker.Visitor

public class AbsolutePathReferenceVisitor
extends Object
implements DomWalker.Visitor

Visitor that resolves relative paths relative to the base tag (only if present) / current page url and marks urls as absolute.

Since:
2.0.0

Nested Class Summary
static class AbsolutePathReferenceVisitor.Tags
           
 
Nested classes/interfaces inherited from interface org.apache.shindig.gadgets.rewrite.DomWalker.Visitor
DomWalker.Visitor.VisitStatus
 
Constructor Summary
AbsolutePathReferenceVisitor(AbsolutePathReferenceVisitor.Tags... resourceTags)
           
 
Method Summary
static Attr getUriAttributeFromNode(Node node, Map<String,String> resourceTags)
          Returns the uri attribute for the given node by looking up the tag name -> uri attribute map.
 boolean revisit(Gadget gadget, List<Node> node)
          Revisit a node in the DOM that was marked by the visit(Gadget, Node) as reserved during DOM traversal.
 DomWalker.Visitor.VisitStatus visit(Gadget gadget, Node node)
          Visit a particular Node in the DOM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbsolutePathReferenceVisitor

@Inject
public AbsolutePathReferenceVisitor(AbsolutePathReferenceVisitor.Tags... resourceTags)
Method Detail

visit

public DomWalker.Visitor.VisitStatus visit(Gadget gadget,
                                           Node node)
                                    throws RewritingException
Description copied from interface: DomWalker.Visitor
Visit a particular Node in the DOM.

Specified by:
visit in interface DomWalker.Visitor
Parameters:
gadget - Context for the request.
node - Node being visited.
Returns:
Status, see VisitStatus
Throws:
RewritingException

revisit

public boolean revisit(Gadget gadget,
                       List<Node> node)
                throws RewritingException
Description copied from interface: DomWalker.Visitor
Revisit a node in the DOM that was marked by the visit(Gadget, Node) as reserved during DOM traversal.

Specified by:
revisit in interface DomWalker.Visitor
Parameters:
gadget - Context for the request.
node - Nodes being revisited, previously marked as reserved.
Returns:
True if any node modified, false otherwise.
Throws:
RewritingException

getUriAttributeFromNode

public static Attr getUriAttributeFromNode(Node node,
                                           Map<String,String> resourceTags)
Returns the uri attribute for the given node by looking up the tag name -> uri attribute map. NOTE: This function returns the node attribute only if the attribute has a non empty value.

Parameters:
node - The node to get uri attribute for.
resourceTags - Map from tag name -> uri attribute name.
Returns:
Uri attribute for the node.


Copyright © 2007-2012. All Rights Reserved.