|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wiki.api.filters.BasicPageFilter org.apache.wiki.filters.SpamFilter
public class SpamFilter
This is Herb, the JSPWiki spamfilter that can also do choke modifications. Parameters:
Please see the default editors/plain.jsp for examples on how the SpamFilter integrates with the editor system.
Changes by admin users are ignored in any case.
Field Summary | |
---|---|
static String |
PROP_AKISMET_API_KEY
The filter property name for specifying the Akismet API-key. |
static String |
PROP_BANTIME
The filter property name for specifying how long a host is banned. |
static String |
PROP_BLACKLIST
The filter property name for the attachment containing the blacklist. |
static String |
PROP_CAPTCHA
The filter property name for specifying which captcha technology should be used. |
static String |
PROP_ERRORPAGE
The filter property name for the page to which you are directed if Herb rejects your edit. |
static String |
PROP_FILTERSTRATEGY
The filter property name for specifying which filter strategy should be used. |
static String |
PROP_IGNORE_AUTHENTICATED
The filter property name for specifying whether authenticated users should be ignored. |
static String |
PROP_MAXURLS
The filter property name for specifying how many URLs can any given edit contain. |
static String |
PROP_PAGECHANGES
The filter property name for specifying how many changes is any given IP address allowed to do per minute. |
static String |
PROP_SIMILARCHANGES
The filter property name for specifying how many similar changes are allowed before a host is banned. |
static String |
PROP_WORDLIST
The filter property name for specifying the page which contains the list of spamwords. |
static String |
STRATEGY_EAGER
The string specifying the "eager" strategy. |
static String |
STRATEGY_SCORE
The string specifying the "score" strategy. |
Fields inherited from class org.apache.wiki.api.filters.BasicPageFilter |
---|
m_engine |
Constructor Summary | |
---|---|
SpamFilter()
|
Method Summary | |
---|---|
static boolean |
checkHash(WikiContext context,
javax.servlet.jsp.PageContext pageContext)
This method checks if the hash value is still valid, i.e. if it exists at all. |
static String |
getBotFieldName()
Returns a static string which can be used to detect spambots which just wildly fill in all the fields. |
static String |
getHashFieldName(javax.servlet.http.HttpServletRequest request)
Returns the name of the hash field to be used in this request. |
static String |
getSpamHash(WikiPage page,
javax.servlet.http.HttpServletRequest request)
This method is used to calculate an unique code when submitting the page to detect edit conflicts. |
void |
initialize(WikiEngine engine,
Properties properties)
If you override this, you should call super.initialize() first. |
static String |
insertInputFields(javax.servlet.jsp.PageContext pageContext)
This helper method adds all the input fields to your editor that the SpamFilter requires to check for spam. |
boolean |
isValidUserProfile(WikiContext context,
UserProfile profile)
Checks whether the UserProfile matches certain checks. |
String |
preSave(WikiContext context,
String content)
This method is called before the page has been saved to the PageProvider. |
Methods inherited from class org.apache.wiki.api.filters.BasicPageFilter |
---|
destroy, postSave, postTranslate, preTranslate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_WORDLIST
public static final String PROP_ERRORPAGE
public static final String PROP_PAGECHANGES
public static final String PROP_SIMILARCHANGES
public static final String PROP_BANTIME
public static final String PROP_BLACKLIST
public static final String PROP_MAXURLS
public static final String PROP_AKISMET_API_KEY
public static final String PROP_IGNORE_AUTHENTICATED
public static final String PROP_CAPTCHA
public static final String PROP_FILTERSTRATEGY
public static final String STRATEGY_EAGER
public static final String STRATEGY_SCORE
Constructor Detail |
---|
public SpamFilter()
Method Detail |
---|
public void initialize(WikiEngine engine, Properties properties)
initialize
in interface PageFilter
initialize
in class BasicPageFilter
engine
- The WikiEngine whic owns this PageFilterproperties
- The properties ripped from filters.xml.public String preSave(WikiContext context, String content) throws RedirectException
preSave
in interface PageFilter
preSave
in class BasicPageFilter
context
- The WikiContextcontent
- The wikimarkup that the user just wanted to save.
RedirectException
public static String getBotFieldName()
public boolean isValidUserProfile(WikiContext context, UserProfile profile)
profile
- The profile to checkcontext
- The WikiContext
public static final String getSpamHash(WikiPage page, javax.servlet.http.HttpServletRequest request)
page
- The WikiPage under editrequest
- The HTTP Request
public static final String getHashFieldName(javax.servlet.http.HttpServletRequest request)
request
- The page request
public static final boolean checkHash(WikiContext context, javax.servlet.jsp.PageContext pageContext) throws IOException
This method puts a redirect to the http response field to page "SessionExpired" and logs the incident in the spam log (it may or may not be spam, but it's rather likely that it is).
context
- The WikiContextpageContext
- The JSP PageContext.
IOException
- If redirection failspublic static final String insertInputFields(javax.servlet.jsp.PageContext pageContext)
pageContext
- The PageContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |