com.ecyrd.jspwiki.filters
Class BasicPageFilter

java.lang.Object
  extended by com.ecyrd.jspwiki.filters.BasicPageFilter
All Implemented Interfaces:
PageFilter
Direct Known Subclasses:
DefaultGroupManager.SaveFilter, PingWeblogsComFilter, ProfanityFilter, ReferenceManager, SearchManager, SpamFilter

public class BasicPageFilter
extends Object
implements PageFilter

Provides a base implementation of a PageFilter. None of the methods do anything, so it is a good idea for you to extend from this class and implement only methods that you need.

Author:
Janne Jalkanen

Constructor Summary
BasicPageFilter()
           
 
Method Summary
 void initialize(Properties properties)
          Is called whenever the a new PageFilter is instantiated and reset.
 void postSave(WikiContext wikiContext, String content)
          This method is called after the page has been successfully saved.
 String postTranslate(WikiContext wikiContext, String htmlContent)
          This method is called after a page has been fed through the TranslatorReader, so anything you are seeing here is translated content.
 String preSave(WikiContext wikiContext, String content)
          This method is called before the page has been saved to the PageProvider.
 String preTranslate(WikiContext wikiContext, String content)
          This method is called whenever a page has been loaded from the provider, but not yet been sent through the TranslatorReader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicPageFilter

public BasicPageFilter()
Method Detail

initialize

public void initialize(Properties properties)
                throws FilterException
Description copied from interface: PageFilter
Is called whenever the a new PageFilter is instantiated and reset.

Specified by:
initialize in interface PageFilter
Throws:
FilterException

preTranslate

public String preTranslate(WikiContext wikiContext,
                           String content)
                    throws FilterException
Description copied from interface: PageFilter
This method is called whenever a page has been loaded from the provider, but not yet been sent through the TranslatorReader. Note that you cannot do HTML translation here, because TranslatorReader is likely to escape it.

Specified by:
preTranslate in interface PageFilter
Parameters:
wikiContext - The current wikicontext.
content - WikiMarkup.
Throws:
FilterException

postTranslate

public String postTranslate(WikiContext wikiContext,
                            String htmlContent)
                     throws FilterException
Description copied from interface: PageFilter
This method is called after a page has been fed through the TranslatorReader, so anything you are seeing here is translated content. If you want to do any of your own WikiMarkup2HTML translation, do it here.

Specified by:
postTranslate in interface PageFilter
Throws:
FilterException

preSave

public String preSave(WikiContext wikiContext,
                      String content)
               throws FilterException
Description copied from interface: PageFilter
This method is called before the page has been saved to the PageProvider.

Specified by:
preSave in interface PageFilter
Throws:
FilterException

postSave

public void postSave(WikiContext wikiContext,
                     String content)
              throws FilterException
Description copied from interface: PageFilter
This method is called after the page has been successfully saved. If the saving fails for any reason, then this method will not be called.

Since the result is discarded from this method, this is only useful for things like counters, etc.

Specified by:
postSave in interface PageFilter
Throws:
FilterException