Package com.academy.utils
Class HttpRequestUtils
- java.lang.Object
-
- com.academy.utils.HttpRequestUtils
-
public class HttpRequestUtils extends java.lang.Object
HTTP Utils- Author:
- Ruslan Nazirov
-
-
Constructor Summary
Constructors Constructor Description HttpRequestUtils()
-
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 methodstatic boolean
antiSpamCheck(javax.servlet.http.HttpServletRequest request, AntiSpamService antiSpamService, java.lang.String operation, java.lang.String data)
Simple anti-spam protection methodstatic java.lang.String
getIpAddress(javax.servlet.http.HttpServletRequest request)
Trying to receive IP address from HTTP Requeststatic boolean
HttpRequestCheck(javax.servlet.http.HttpServletRequest request)
Check if HTTP request is valid
-
-
-
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 RequestantiSpamService
- Anti-Spam service referenceoperation
- 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 RequestantiSpamService
- Anti-Spam service referenceoperation
- executed operationdata
- 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
-
-