Package ca.uqac.lif.cep.apache
Class HttpRequest
java.lang.Object
ca.uqac.lif.cep.apache.HttpRequest
Representation of an HTTP request, as logged by an Apache server
- Author:
- Sylvain Hallé
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFunction to get the path of an HTTP requeststatic classFunction to get the path of an HTTP requeststatic classFunction to get the timestamp of an HTTP requeststatic enumThe HTTP method used in the requeststatic classFunction to compare the request's time with another time -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringRemote identification of the userprotected final HttpRequest.MethodThe method used for the request (GET, POST)The parameters of this methodprotected final StringThe path of the requestprotected final intThe response code sentprotected final intThe size of the response sentprotected final StringThe source IP addressprotected final longThe time of the request: a Unix timestamp in secondsprotected final StringUser ID -
Constructor Summary
ConstructorsConstructorDescriptionHttpRequest(String source_ip, String identd, String userid, long unix_time, HttpRequest.Method method, String path, Map<String, String> parameters, int response_code, int size) Creates a new HTTP request event -
Method Summary
Modifier and TypeMethodDescriptionstatic longdateToTimestamp(Calendar calendar, String time_string) Converts a date in the format YYYY-MM-DD HH:MM:SS into a Unix timestamp.Gets the value of a parameter in the HTTP requestGets the method of this HTTP requestReturns the parameters associated with this HTTP requestgetPath()Gets the path of this HTTP requestintGets the response code of this HTTP requestintGets the size of the response to this HTTP requestGets the source IP address of this HTTP requestlongGets the timestamp of this requestgetUser()Gets the user associated to this HTTP requesttoString()
-
Field Details
-
m_sourceIp
The source IP address -
m_identd
Remote identification of the user -
m_userId
User ID -
m_unixTime
protected final long m_unixTimeThe time of the request: a Unix timestamp in seconds -
m_method
The method used for the request (GET, POST) -
m_path
The path of the request -
m_parameters
The parameters of this method -
m_responseCode
protected final int m_responseCodeThe response code sent -
m_size
protected final int m_sizeThe size of the response sent
-
-
Constructor Details
-
HttpRequest
public HttpRequest(String source_ip, String identd, String userid, long unix_time, HttpRequest.Method method, String path, Map<String, String> parameters, int response_code, int size) Creates a new HTTP request event- Parameters:
source_ip- The source IP addressidentd- The identifieruserid- The user IDunix_time- A Unix timestampmethod- The method (i.e. GET, POST, etc.)path- The URL's pathparameters- The URL's parameters, if anyresponse_code- The response code of this requestsize- The size of the request
-
-
Method Details
-
getSourceIp
Gets the source IP address of this HTTP request- Returns:
- The address
-
getTimestamp
public long getTimestamp()Gets the timestamp of this request- Returns:
- The Unix timestamp
-
getResponseSize
public int getResponseSize()Gets the size of the response to this HTTP request- Returns:
- The size of the response
-
getResponseCode
public int getResponseCode()Gets the response code of this HTTP request- Returns:
- The code
-
getUser
Gets the user associated to this HTTP request- Returns:
- The user
-
getMethod
Gets the method of this HTTP request- Returns:
- The method
-
getPath
Gets the path of this HTTP request- Returns:
- The path
-
getParameters
Returns the parameters associated with this HTTP request- Returns:
- The parameters
-
get
Gets the value of a parameter in the HTTP request- Parameters:
parameter_name- The name of the parameter- Returns:
- The value if the parameter exists,
nullotherwise
-
dateToTimestamp
Converts a date in the format YYYY-MM-DD HH:MM:SS into a Unix timestamp. The time is optional, and if specified, the seconds are optional.- Parameters:
calendar- An instance of calendar objecttime_string- The time string- Returns:
- The timestamp
-
toString
-