|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PageFilter
Provides a definition for a page filter. A page filter is a class that can be used to transform the WikiPage content being saved or being loaded at any given time.
Note that the WikiContext.getPage() method always returns the context in which text is rendered, i.e. the original request. Thus the content may actually be different content than what what the wikiContext.getPage() implies! This happens often if you are for example including multiple pages on the same page.
PageFilters must be thread-safe! There is only one instance of each PageFilter per each WikiEngine invocation. If you need to store data persistently, use VariableManager, or WikiContext.
As of 2.5.30, initialize() gains access to the WikiEngine.
Method Summary | |
---|---|
void |
destroy(WikiEngine engine)
Called for every filter, e.g. on wiki engine shutdown. |
void |
initialize(WikiEngine engine,
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 translation process, 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 markup-translation process. |
Method Detail |
---|
void initialize(WikiEngine engine, Properties properties) throws FilterException
engine
- The WikiEngine whic owns this PageFilterproperties
- The properties ripped from filters.xml.
FilterException
- If the filter could not be initialized. If this is thrown,
the filter is not added to the internal queues.String preTranslate(WikiContext wikiContext, String content) throws FilterException
wikiContext
- The current wikicontext.content
- WikiMarkup.
FilterException
- If something goes wrong. Throwing this causes the entire page
processing to be abandoned.String postTranslate(WikiContext wikiContext, String htmlContent) throws FilterException
wikiContext
- The WikiContext.htmlContent
- The translated HTML
FilterException
- If something goes wrong. Throwing this causes the entire page
processing to be abandoned.String preSave(WikiContext wikiContext, String content) throws FilterException
wikiContext
- The WikiContextcontent
- The wikimarkup that the user just wanted to save.
FilterException
- If something goes wrong. Throwing this causes the entire page
processing to be abandoned.void postSave(WikiContext wikiContext, String content) throws FilterException
Since the result is discarded from this method, this is only useful for things like counters, etc.
wikiContext
- The WikiContextcontent
- The content which was just stored.
FilterException
- If something goes wrong. As the page is already saved,
This is just logged.void destroy(WikiEngine engine)
engine
- The WikiEngine which owns this filter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |