public class SpamFilter extends BasePageFilter
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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_AKISMET_API_KEY
The filter property name for specifying the Akismet API-key.
|
static java.lang.String |
PROP_ALLOWED_GROUPS
The filter property name for specifying groups allowed to bypass the spam filter.
|
static java.lang.String |
PROP_BANTIME
The filter property name for specifying how long a host is banned.
|
static java.lang.String |
PROP_BLACKLIST
The filter property name for the attachment containing the blacklist.
|
static java.lang.String |
PROP_CAPTCHA
The filter property name for specifying which captcha technology should be used.
|
static java.lang.String |
PROP_ERRORPAGE
The filter property name for the page to which you are directed if Herb rejects your edit.
|
static java.lang.String |
PROP_FILTERSTRATEGY
The filter property name for specifying which filter strategy should be used.
|
static java.lang.String |
PROP_IGNORE_AUTHENTICATED
The filter property name for specifying whether authenticated users should be ignored.
|
static java.lang.String |
PROP_IPLIST
The filter property name for specifying the page which contains the list of IPs to ban.
|
static java.lang.String |
PROP_MAX_PAGENAME_LENGTH
The filter property name for specifying the maximum page name length.
|
static java.lang.String |
PROP_MAXURLS
The filter property name for specifying how many URLs can any given edit contain.
|
static java.lang.String |
PROP_PAGECHANGES
The filter property name for specifying how many changes is any given IP address
allowed to do per minute.
|
static java.lang.String |
PROP_SIMILARCHANGES
The filter property name for specifying how many similar changes are allowed before a host is banned.
|
static java.lang.String |
PROP_WORDLIST
The filter property name for specifying the page which contains the list of spamwords.
|
static java.lang.String |
STRATEGY_EAGER
The string specifying the "eager" strategy.
|
static java.lang.String |
STRATEGY_SCORE
The string specifying the "score" strategy.
|
m_engine| Constructor and Description |
|---|
SpamFilter() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkHash(Context context,
javax.servlet.jsp.PageContext pageContext)
This method checks if the hash value is still valid, i.e. if it exists at all.
|
static java.lang.String |
getBotFieldName()
Returns a static string which can be used to detect spambots which just wildly fill in all the fields.
|
static java.lang.String |
getHashFieldName(javax.servlet.http.HttpServletRequest request)
Returns the name of the hash field to be used in this request.
|
static java.lang.String |
getSpamHash(Page 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(Engine engine,
java.util.Properties properties) |
static java.lang.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(Context context,
UserProfile profile)
Checks whether the UserProfile matches certain checks.
|
java.lang.String |
preSave(Context context,
java.lang.String content) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, postSave, postTranslate, preTranslatepublic static final java.lang.String PROP_WORDLIST
public static final java.lang.String PROP_IPLIST
public static final java.lang.String PROP_MAX_PAGENAME_LENGTH
public static final java.lang.String PROP_ERRORPAGE
public static final java.lang.String PROP_PAGECHANGES
public static final java.lang.String PROP_SIMILARCHANGES
public static final java.lang.String PROP_BANTIME
public static final java.lang.String PROP_BLACKLIST
public static final java.lang.String PROP_MAXURLS
public static final java.lang.String PROP_AKISMET_API_KEY
public static final java.lang.String PROP_IGNORE_AUTHENTICATED
public static final java.lang.String PROP_ALLOWED_GROUPS
public static final java.lang.String PROP_CAPTCHA
public static final java.lang.String PROP_FILTERSTRATEGY
public static final java.lang.String STRATEGY_EAGER
public static final java.lang.String STRATEGY_SCORE
public SpamFilter()
public void initialize(Engine engine, java.util.Properties properties)
initialize in interface PageFilterinitialize in class BasePageFilterpublic java.lang.String preSave(Context context, java.lang.String content) throws RedirectException
RedirectExceptionpublic static java.lang.String getBotFieldName()
public boolean isValidUserProfile(Context context, UserProfile profile)
profile - The profile to checkcontext - The WikiContextpublic static java.lang.String getSpamHash(Page page, javax.servlet.http.HttpServletRequest request)
page - The WikiPage under editrequest - The HTTP Requestpublic static java.lang.String getHashFieldName(javax.servlet.http.HttpServletRequest request)
request - The page requestpublic static boolean checkHash(Context context, javax.servlet.jsp.PageContext pageContext) throws java.io.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.java.io.IOException - If redirection failspublic static java.lang.String insertInputFields(javax.servlet.jsp.PageContext pageContext)
pageContext - The PageContextCopyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.