public final class FilterManager extends ModuleManager
The initial page filter configuration is kept in a file called "filters.xml". The format is really very simple:
The <filter> -sections define the filters. For more information, please see the PageFilterConfiguration page in the JSPWiki distribution.com.ecyrd.jspwiki.filters.ProfanityFilter com.ecyrd.jspwiki.filters.TestFilter foobar Zippadippadai blatblaa 5
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_XMLFILE
Default location for the filter XML property file.
|
static java.lang.String |
PROP_FILTERXML
Property name for setting the filter XML property file.
|
static int |
SYSTEM_FILTER_PRIORITY
JSPWiki system filters are all below this value.
|
static int |
USER_FILTER_PRIORITY
The standard user level filtering.
|
m_engine, PLUGIN_RESOURCE_LOCATION| Constructor and Description |
|---|
FilterManager(WikiEngine engine,
java.util.Properties props)
Constructs a new FilterManager object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPageFilter(PageFilter f,
int priority)
Adds a page filter to the queue.
|
void |
destroy()
Notifies PageFilters to clean up their ressources.
|
void |
doPostSaveFiltering(WikiContext context,
java.lang.String pageData)
Does the page filtering after the page has been saved.
|
java.lang.String |
doPostTranslateFiltering(WikiContext context,
java.lang.String htmlData)
Does the filtering after HTML translation.
|
java.lang.String |
doPreSaveFiltering(WikiContext context,
java.lang.String pageData)
Does the filtering before a save to the page repository.
|
java.lang.String |
doPreTranslateFiltering(WikiContext context,
java.lang.String pageData)
Does the filtering before a translation.
|
void |
fireEvent(int type,
WikiContext context)
Fires a WikiPageEvent of the provided type and WikiContext.
|
java.util.List |
getFilterList()
Returns the list of filters currently installed.
|
protected void |
initialize(java.util.Properties props)
Initializes the filters from an XML file.
|
java.util.Collection |
modules()
Returns a collection of modules currently managed by this ModuleManager.
|
checkCompatibilitypublic static final java.lang.String PROP_FILTERXML
public static final java.lang.String DEFAULT_XMLFILE
public static final int SYSTEM_FILTER_PRIORITY
public static final int USER_FILTER_PRIORITY
public FilterManager(WikiEngine engine, java.util.Properties props) throws WikiException
engine - The WikiEngine which owns the FilterManagerprops - Properties to initialize the FilterManager withWikiException - If something goes wrong.public void addPageFilter(PageFilter f, int priority) throws java.lang.IllegalArgumentException
In case two filters have the same priority, their execution order is the insertion order.
f - PageFilter to addpriority - The priority in which position to add it in.java.lang.IllegalArgumentException - If the PageFilter is null or invalid.protected void initialize(java.util.Properties props)
throws WikiException
props - The list of properties. Typically jspwiki.propertiesWikiException - If something goes wrong.public java.lang.String doPreTranslateFiltering(WikiContext context, java.lang.String pageData) throws FilterException
context - The WikiContextpageData - WikiMarkup data to be passed through the preTranslate
chain.FilterException - If any of the filters throws a FilterExceptionPageFilter.preTranslate(WikiContext, String)public java.lang.String doPostTranslateFiltering(WikiContext context, java.lang.String htmlData) throws FilterException
context - The WikiContexthtmlData - HTML data to be passed through the postTranslateFilterException - If any of the filters throws a FilterExceptionPageFilter.postTranslate(WikiContext, String)public java.lang.String doPreSaveFiltering(WikiContext context, java.lang.String pageData) throws FilterException
context - The WikiContextpageData - WikiMarkup data to be passed through the preSave chain.FilterException - If any of the filters throws a FilterExceptionPageFilter.preSave(WikiContext, String)public void doPostSaveFiltering(WikiContext context, java.lang.String pageData) throws FilterException
context - The WikiContextpageData - WikiMarkup data to be passed through the postSave chain.FilterException - If any of the filters throws a FilterExceptionPageFilter.postSave(WikiContext, String)public java.util.List getFilterList()
public void destroy()
public final void fireEvent(int type,
WikiContext context)
type - the WikiPageEvent type to be fired.context - the WikiContext of the event.WikiPageEventpublic java.util.Collection modules()
modules in class ModuleManagerstSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.