public class DefaultFilterManager extends ModuleManager implements FilterManager
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.org.apache.wiki.filters.ProfanityFilter org.apache.wiki.filters.TestFilter foobar Zippadippadai blatblaa 5
m_engine, PLUGIN_RESOURCE_LOCATION
DEFAULT_XMLFILE, PROP_FILTERXML, SYSTEM_FILTER_PRIORITY, USER_FILTER_PRIORITY
Constructor and Description |
---|
DefaultFilterManager(WikiEngine engine,
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,
String pageData)
Does the page filtering after the page has been saved.
|
String |
doPostTranslateFiltering(WikiContext context,
String htmlData)
Does the filtering after HTML translation.
|
String |
doPreSaveFiltering(WikiContext context,
String pageData)
Does the filtering before a save to the page repository.
|
String |
doPreTranslateFiltering(WikiContext context,
String pageData)
Does the filtering before a translation.
|
void |
fireEvent(int type,
WikiContext context)
Fires a WikiPageEvent of the provided type and WikiContext.
|
List<PageFilter> |
getFilterList()
Returns the list of filters currently installed.
|
org.apache.wiki.filters.DefaultFilterManager.PageFilterInfo |
getModuleInfo(String moduleName)
Returns the
WikiModuleInfo information about the provided moduleName. |
protected void |
initialize(Properties props)
Initializes the filters from an XML file.
|
Collection<WikiModuleInfo> |
modules()
Returns a collection of modules currently managed by this ModuleManager.
|
checkCompatibility, modules
public DefaultFilterManager(WikiEngine engine, 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 IllegalArgumentException
In case two filters have the same priority, their execution order is the insertion order.
addPageFilter
in interface FilterManager
f
- PageFilter to addpriority
- The priority in which position to add it in.IllegalArgumentException
- If the PageFilter is null or invalid.protected void initialize(Properties props) throws WikiException
props
- The list of properties. Typically jspwiki.propertiesWikiException
- If something goes wrong.public String doPreTranslateFiltering(WikiContext context, String pageData) throws FilterException
doPreTranslateFiltering
in interface FilterManager
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 String doPostTranslateFiltering(WikiContext context, String htmlData) throws FilterException
doPostTranslateFiltering
in interface FilterManager
context
- The WikiContexthtmlData
- HTML data to be passed through the postTranslateFilterException
- If any of the filters throws a FilterExceptionPageFilter.postTranslate(WikiContext, String)
public String doPreSaveFiltering(WikiContext context, String pageData) throws FilterException
doPreSaveFiltering
in interface FilterManager
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, String pageData) throws FilterException
doPostSaveFiltering
in interface FilterManager
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 List<PageFilter> getFilterList()
getFilterList
in interface FilterManager
public void destroy()
destroy
in interface FilterManager
public void fireEvent(int type, WikiContext context)
type
- the WikiPageEvent type to be fired.context
- the WikiContext of the event.WikiPageEvent
public Collection<WikiModuleInfo> modules()
modules
in interface FilterManager
modules
in class ModuleManager
public org.apache.wiki.filters.DefaultFilterManager.PageFilterInfo getModuleInfo(String moduleName)
WikiModuleInfo
information about the provided moduleName.getModuleInfo
in interface FilterManager
getModuleInfo
in class ModuleManager
Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.