Package sk.iway.iwcm
Class SpamProtection
java.lang.Object
sk.iway.iwcm.SpamProtection
SpamProtection.java
This class keeps a track of user's posts on our server and forbids any more posts, if
he already reached a limit.
Behaviour of this class can be modified by configuration parameters:
1. spamProtectionTimeout - what is the maximum time span between two distinct posts
2. spamProtectionHourlyLimit - limit of posts that a user can send in an hour
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Determines, whether a post to a given module and from a given IP address is allowed to be posted.static void
clearAll()
Clear all mapsstatic long
crossMinitLimit
(String module, javax.servlet.http.HttpServletRequest request) Momentalne kvoli ing insurance Systém CMS dovolí prepísať profil maximálne 3x za sebou v priebehu jednej minúty, v takom prípade povolí zápis až 5 minút od posledného zápisustatic long
crossMinuteLimit
(String module, javax.servlet.http.HttpServletRequest request) Momentalne kvoli ing insurance Systém CMS dovolí prepísať profil maximálne 3x za sebou v priebehu jednej minúty, v takom prípade povolí zápis až 5 minút od posledného zápisustatic void
destroy()
static int
getHourlyPostLimit
(String module) static int
getMinitPostLimit
(String module) static int
getMinutePostLimit
(String module) static long
getTimeout
(String module) static long
getWaitTimeout
(String module, javax.servlet.http.HttpServletRequest request) Vracia cas do vyprsania obmedzenia !Pozor, neriesi rychle klikanie pouzivatela, len hodinovy Limit! Standardne, ak netreba ziskavat cas, staci volat metodu canPost(module, post, request)
-
Field Details
-
HOURLY_LIMIT_KEY
- See Also:
-
MINIT_LIMIT_KEY
- See Also:
-
MINUTE_LIMIT_KEY
- See Also:
-
TIMEOUT_KEY
- See Also:
-
-
Constructor Details
-
SpamProtection
protected SpamProtection()
-
-
Method Details
-
canPost
public static boolean canPost(String module, String post, javax.servlet.http.HttpServletRequest request) Determines, whether a post to a given module and from a given IP address is allowed to be posted.- Parameters:
module
- Module, which is used to make a postpost
- Text version of a post - unusedrequest
-- Returns:
Boolean
- whether the post can be performed or not
-
crossMinuteLimit
Momentalne kvoli ing insurance Systém CMS dovolí prepísať profil maximálne 3x za sebou v priebehu jednej minúty, v takom prípade povolí zápis až 5 minút od posledného zápisu- Parameters:
module
-request
-- Returns:
-
crossMinitLimit
Momentalne kvoli ing insurance Systém CMS dovolí prepísať profil maximálne 3x za sebou v priebehu jednej minúty, v takom prípade povolí zápis až 5 minút od posledného zápisu- Parameters:
module
-request
-- Returns:
-
getMinitPostLimit
-
getHourlyPostLimit
-
getTimeout
-
getWaitTimeout
Vracia cas do vyprsania obmedzenia !Pozor, neriesi rychle klikanie pouzivatela, len hodinovy Limit! Standardne, ak netreba ziskavat cas, staci volat metodu canPost(module, post, request) -
getMinutePostLimit
-
destroy
public static void destroy() -
clearAll
public static void clearAll()Clear all maps
-