org.ceryle.wiki.filters
Class PermittedPageFilter

java.lang.Object
  extended by com.ecyrd.jspwiki.filters.BasicPageFilter
      extended by org.ceryle.wiki.filters.PermittedPageFilter
All Implemented Interfaces:
PageFilter

public class PermittedPageFilter
extends BasicPageFilter

A page filter that blocks access to all but a predefined set of pages. The permitted pages are defined on a wiki page called "PermittedPages", the error page the contents of the wiki page named "Forbidden".

If the PermittedPages page does not exist this filter does nothing, passing the content through with no change in behaviour. If the Forbidden page does not exist a generic 403-style XHTML error message is returned.

So that the list of permitted pages doesn't have to be compiled upon each page request, the list is cached on periodic intervals. The interval is determined by a variable that can be set from a property.

NOTE: this class is not currently functional.

Overriding the Defaults via filters.xml Parameters

The default values can be altered by passing the following (optional) parameters from the filters.xml file:

A sample filters.xml file is appended as a comment on the source.

Version:
$Id: PermittedPageFilter.java,v 1.1 2007-07-19 12:05:34 altheim Exp $
Author:
Murray Altheim

Field Summary
protected  String m_403_message
          The content of the 403-style Forbidden error message (in wiki text).
protected  boolean m_enabled
          When true enables the filter.
protected  String m_forbiddenPageName
          The name of the forbidden (403 error) page.
protected  boolean m_permitFrontPage
          When true permits unfiltered access to the front (Main) page.
protected  String m_permittedPageName
          The name of the permitted page list.
protected  long m_refresh
          The time in milliseconds between refreshes of the page list.
static String PROPERTY_403_MESSAGE
          The name of the property setting the content of the error message (in wiki text).
static String PROPERTY_FILTER_ENABLE
          The name of the property that when "true" enables the filter.
static String PROPERTY_PAGE_FORBIDDEN
          The name of the property setting the name of the Forbidden page.
static String PROPERTY_PAGE_LIST
          The name of the property setting the name of the permitted page list.
static String PROPERTY_PERMIT_FRONT
          The name of the property permitting unfiltered display of the front page.
static String PROPERTY_REFRESH
          The name of the property setting the name of the refresh period in milliseconds.
 
Fields inherited from class com.ecyrd.jspwiki.filters.BasicPageFilter
m_engine
 
Constructor Summary
PermittedPageFilter()
           
 
Method Summary
 void initialize(WikiEngine engine, Properties properties)
          Overrides the method in BasicPageFilter to set the WikiEngine and read in any properties from filters.xml.
 String preTranslate(WikiContext context, String content)
          Extends the method in BasicPageFilter to check the page name against the permitted page list, returning an error message if the page fails the test.
 
Methods inherited from class com.ecyrd.jspwiki.filters.BasicPageFilter
destroy, postSave, postTranslate, preSave
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_FILTER_ENABLE

public static final String PROPERTY_FILTER_ENABLE
The name of the property that when "true" enables the filter.

See Also:
Constant Field Values

PROPERTY_PAGE_LIST

public static final String PROPERTY_PAGE_LIST
The name of the property setting the name of the permitted page list.

See Also:
Constant Field Values

PROPERTY_PAGE_FORBIDDEN

public static final String PROPERTY_PAGE_FORBIDDEN
The name of the property setting the name of the Forbidden page.

See Also:
Constant Field Values

PROPERTY_REFRESH

public static final String PROPERTY_REFRESH
The name of the property setting the name of the refresh period in milliseconds.

See Also:
Constant Field Values

PROPERTY_PERMIT_FRONT

public static final String PROPERTY_PERMIT_FRONT
The name of the property permitting unfiltered display of the front page.

See Also:
Constant Field Values

PROPERTY_403_MESSAGE

public static final String PROPERTY_403_MESSAGE
The name of the property setting the content of the error message (in wiki text).

See Also:
Constant Field Values

m_refresh

protected long m_refresh
The time in milliseconds between refreshes of the page list. If this much time has passed since the last compilation, the list is considered out of date and will be recompiled. Setting this to -1 will cause a recompilation upon each request.


m_permittedPageName

protected String m_permittedPageName
The name of the permitted page list.


m_forbiddenPageName

protected String m_forbiddenPageName
The name of the forbidden (403 error) page.


m_enabled

protected boolean m_enabled
When true enables the filter. The default is true.


m_permitFrontPage

protected boolean m_permitFrontPage
When true permits unfiltered access to the front (Main) page.


m_403_message

protected String m_403_message
The content of the 403-style Forbidden error message (in wiki text).

Constructor Detail

PermittedPageFilter

public PermittedPageFilter()
Method Detail

initialize

public void initialize(WikiEngine engine,
                       Properties properties)
                throws FilterException
Overrides the method in BasicPageFilter to set the WikiEngine and read in any properties from filters.xml.

Specified by:
initialize in interface PageFilter
Overrides:
initialize in class BasicPageFilter
Throws:
FilterException

preTranslate

public String preTranslate(WikiContext context,
                           String content)
Extends the method in BasicPageFilter to check the page name against the permitted page list, returning an error message if the page fails the test.

Specified by:
preTranslate in interface PageFilter
Overrides:
preTranslate in class BasicPageFilter


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.