Package fr.yunes
Class AccessEntry
- java.lang.Object
-
- fr.yunes.AccessEntry
-
public class AccessEntry extends java.lang.Object
TheAccessEntry
class represents entries of Apache access.log files. This is a primitive implementation of what is expected. Thus, this is not for real life usage, only for training purpose.- Version:
- 1.0
- Author:
- yunes
-
-
Constructor Summary
Constructors Constructor Description AccessEntry(java.lang.String line)
Constructs a newAccessEntry
from a givenString
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCode()
java.time.ZonedDateTime
getDate()
int
getLength()
java.lang.String
getProto()
java.lang.String
getRequest()
java.lang.String
getText()
java.lang.String
getURL()
UserAgent
getUserAgent()
boolean
isCorrect()
java.lang.String
toString()
-
-
-
Constructor Detail
-
AccessEntry
public AccessEntry(java.lang.String line)
Constructs a newAccessEntry
from a givenString
. Strings must roughly be in Apache custom log format, i.e.:
109.184.11.34 - - [12/Dec/2015:18:32:56 +0100] "GET /administrator/ HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0" "-"
If the string can't be parsed, the object is in incorrect state and the string is stored in the text property.- Parameters:
line
- the string to be parsed.
-
-
Method Detail
-
getProto
public java.lang.String getProto()
-
getCode
public int getCode()
-
getRequest
public java.lang.String getRequest()
-
getURL
public java.lang.String getURL()
-
isCorrect
public boolean isCorrect()
-
getUserAgent
public UserAgent getUserAgent()
-
getDate
public java.time.ZonedDateTime getDate()
-
getLength
public int getLength()
-
getText
public java.lang.String getText()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-