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 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_IPLIST
The filter property name for specifying the page which contains the list of IPs to ban.
|
static String |
PROP_MAX_PAGENAME_LENGTH
The filter property name for specifying the maximum page name length.
|
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.
|
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 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(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,
Properties properties) |
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(Context context,
UserProfile profile)
Checks whether the UserProfile matches certain checks.
|
String |
preSave(Context context,
String content) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, postSave, postTranslate, preTranslatepublic static final String PROP_WORDLIST
public static final String PROP_IPLIST
public static final String PROP_MAX_PAGENAME_LENGTH
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
public SpamFilter()
public void initialize(Engine engine, Properties properties)
initialize in interface PageFilterinitialize in class BasePageFilterpublic String preSave(Context context, String content) throws RedirectException
RedirectExceptionpublic static String getBotFieldName()
public boolean isValidUserProfile(Context context, UserProfile profile)
profile - The profile to checkcontext - The WikiContextpublic static final String getSpamHash(Page page, javax.servlet.http.HttpServletRequest request)
page - The WikiPage under editrequest - The HTTP Requestpublic static final String getHashFieldName(javax.servlet.http.HttpServletRequest request)
request - The page requestpublic static final boolean checkHash(Context 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 PageContextCopyright © 2001-2020 The Apache Software Foundation. All rights reserved.