org.apache.jetspeed.rewriter
Class RulesetRewriterImpl

java.lang.Object
  extended byorg.apache.jetspeed.rewriter.AbstractRewriter
      extended byorg.apache.jetspeed.rewriter.BasicRewriter
          extended byorg.apache.jetspeed.rewriter.RulesetRewriterImpl
All Implemented Interfaces:
Rewriter, RulesetRewriter
Direct Known Subclasses:
WebContentRewriter

public class RulesetRewriterImpl
extends BasicRewriter
implements RulesetRewriter

RuleBasedRewriter

Version:
$Id: RulesetRewriterImpl.java 188328 2005-02-08 19:08:40Z rogerrut $
Author:
David Sean Taylor

Field Summary
private  boolean removeComments
           
private  Ruleset ruleset
           
 
Fields inherited from class org.apache.jetspeed.rewriter.AbstractRewriter
 
Constructor Summary
RulesetRewriterImpl()
           
 
Method Summary
 void enterConvertTagEvent(String tagid, MutableAttributes attributes)
          Rewriter event called back just before tag conversion (rewriter callbacks) begins by the ParserAdaptor.
 Ruleset getRuleset()
          Get the Ruleset configuration for this rewriter.
 String rewriteUrl(String url, String tag, String attribute)
          This event is the inteface between the Rewriter and ParserAdaptor for rewriting URLs.
 void setRuleset(Ruleset ruleset)
          Set the Ruleset configuration for this rewriter.
 boolean shouldRemoveComments()
          Returns true if all comments should be removed.
 boolean shouldRemoveTag(String tagid)
          Returns true if the tag should be removed, otherwise false.
 boolean shouldStripTag(String tagid)
          Returns true if the tag should be stripped, otherwise false.
 
Methods inherited from class org.apache.jetspeed.rewriter.AbstractRewriter
enterEndTagEvent, enterSimpleTagEvent, enterStartTagEvent, enterText, exitEndTagEvent, exitSimpleTagEvent, exitStartTagEvent, getBaseUrl, getUseProxy, parse, rewrite, setBaseUrl, setUseProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jetspeed.rewriter.Rewriter
enterEndTagEvent, enterSimpleTagEvent, enterStartTagEvent, enterText, exitEndTagEvent, exitSimpleTagEvent, exitStartTagEvent, getBaseUrl, getUseProxy, parse, rewrite, setBaseUrl, setUseProxy
 

Field Detail

ruleset

private Ruleset ruleset

removeComments

private boolean removeComments
Constructor Detail

RulesetRewriterImpl

public RulesetRewriterImpl()
Method Detail

shouldStripTag

public boolean shouldStripTag(String tagid)
Description copied from interface: Rewriter
Returns true if the tag should be stripped, otherwise false. Stripping tags removes the start and end tag, plus all tags and content in between the start and end tag.

Specified by:
shouldStripTag in interface Rewriter
Overrides:
shouldStripTag in class BasicRewriter

shouldRemoveTag

public boolean shouldRemoveTag(String tagid)
Description copied from interface: Rewriter
Returns true if the tag should be removed, otherwise false. Removing a tag only removes the tag but not the contents in between the start and end tag.

Specified by:
shouldRemoveTag in interface Rewriter
Overrides:
shouldRemoveTag in class BasicRewriter

setRuleset

public void setRuleset(Ruleset ruleset)
Description copied from interface: RulesetRewriter
Set the Ruleset configuration for this rewriter.

Specified by:
setRuleset in interface RulesetRewriter
Parameters:
ruleset - The Ruleset configuration.

getRuleset

public Ruleset getRuleset()
Description copied from interface: RulesetRewriter
Get the Ruleset configuration for this rewriter.

Specified by:
getRuleset in interface RulesetRewriter
Returns:
The Ruleset configuration.

shouldRemoveComments

public boolean shouldRemoveComments()
Description copied from interface: Rewriter
Returns true if all comments should be removed.

Specified by:
shouldRemoveComments in interface Rewriter
Overrides:
shouldRemoveComments in class BasicRewriter

enterConvertTagEvent

public void enterConvertTagEvent(String tagid,
                                 MutableAttributes attributes)
Description copied from interface: Rewriter
Rewriter event called back just before tag conversion (rewriter callbacks) begins by the ParserAdaptor.

Specified by:
enterConvertTagEvent in interface Rewriter
Overrides:
enterConvertTagEvent in class AbstractRewriter

rewriteUrl

public String rewriteUrl(String url,
                         String tag,
                         String attribute)
Description copied from interface: Rewriter
This event is the inteface between the Rewriter and ParserAdaptor for rewriting URLs. The ParserAdaptor calls back the Rewriter when it finds a URL that is a candidate to be rewritten. The Rewriter rewrites the URL and returns it as the result of this function.

Specified by:
rewriteUrl in interface Rewriter
Overrides:
rewriteUrl in class BasicRewriter


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.