Class HttpRequestUtils


  • public class HttpRequestUtils
    extends java.lang.Object
    HTTP Utils
    Author:
    Ruslan Nazirov
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean antiSpamCheck​(javax.servlet.http.HttpServletRequest request, AntiSpamService antiSpamService, java.lang.String operation)
      Simple anti-spam protection method
      static boolean antiSpamCheck​(javax.servlet.http.HttpServletRequest request, AntiSpamService antiSpamService, java.lang.String operation, java.lang.String data)
      Simple anti-spam protection method
      static java.lang.String getIpAddress​(javax.servlet.http.HttpServletRequest request)
      Trying to receive IP address from HTTP Request
      static boolean HttpRequestCheck​(javax.servlet.http.HttpServletRequest request)
      Check if HTTP request is valid
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HttpRequestUtils

        public HttpRequestUtils()
    • Method Detail

      • HttpRequestCheck

        public static boolean HttpRequestCheck​(javax.servlet.http.HttpServletRequest request)
        Check if HTTP request is valid
        Parameters:
        request - HTTP Request
        Returns:
        true if request is valid
      • antiSpamCheck

        public static boolean antiSpamCheck​(javax.servlet.http.HttpServletRequest request,
                                            AntiSpamService antiSpamService,
                                            java.lang.String operation)
        Simple anti-spam protection method
        Parameters:
        request - HTTP Request
        antiSpamService - Anti-Spam service reference
        operation - executed operation
        Returns:
        true if operation is allowed by anti-spam service
      • antiSpamCheck

        public static boolean antiSpamCheck​(javax.servlet.http.HttpServletRequest request,
                                            AntiSpamService antiSpamService,
                                            java.lang.String operation,
                                            java.lang.String data)
        Simple anti-spam protection method
        Parameters:
        request - HTTP Request
        antiSpamService - Anti-Spam service reference
        operation - executed operation
        data - if operation have specific data and each request has it, check for previous call data equality
        Returns:
        true if operation is allowed by anti-spam service
      • getIpAddress

        public static java.lang.String getIpAddress​(javax.servlet.http.HttpServletRequest request)
        Trying to receive IP address from HTTP Request
        Parameters:
        request - HTTP Request
        Returns:
        IP Address of a client