Package sk.iway.iwcm

Class SpamProtection

java.lang.Object
sk.iway.iwcm.SpamProtection

public class SpamProtection extends Object
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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static void
    Clear all maps
    static 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ápisu
    static 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ápisu
    static void
     
    static int
     
    static int
     
    static int
     
    static long
     
    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)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 post
      post - Text version of a post - unused
      request -
      Returns:
      Boolean - whether the post can be performed or not
    • crossMinuteLimit

      public static 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ápisu
      Parameters:
      module -
      request -
      Returns:
    • crossMinitLimit

      public static 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ápisu
      Parameters:
      module -
      request -
      Returns:
    • getMinitPostLimit

      public static int getMinitPostLimit(String module)
    • getHourlyPostLimit

      public static int getHourlyPostLimit(String module)
    • getTimeout

      public static long getTimeout(String module)
    • getWaitTimeout

      public 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)
    • getMinutePostLimit

      public static int getMinutePostLimit(String module)
    • destroy

      public static void destroy()
    • clearAll

      public static void clearAll()
      Clear all maps