CS 1705 Library

cs1705.weblog
Class LogEntry

java.lang.Object
  extended by cs1705.weblog.LogEntry

public class LogEntry
extends Object

Store the data from a single line of a web-server log file. Individual fields are made available via accessors.

Version:
2003.10.31
Author:
Stephen Edwards

Constructor Summary
LogEntry(String logLine)
          Decompose a log line so that the individual fields are available.
 
Method Summary
 Calendar accessTime()
          Get the access time for the HTTP request contained in this log line.
 String browser()
          Get the identification information for the browser making the request.
 String referrer()
          Get the URL of the "referrer" containing the link used to make the request.
 String request()
          Get the request method, URL, and protocol for this log line.
 int resultCode()
          Get the result code returned by the server.
 String toString()
          Create a string representation of the data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogEntry

public LogEntry(String logLine)
Decompose a log line so that the individual fields are available.

Parameters:
logLine - A single line from the log.
Method Detail

accessTime

public Calendar accessTime()
Get the access time for the HTTP request contained in this log line.

Returns:
The access time as a Calendar object

request

public String request()
Get the request method, URL, and protocol for this log line.

Returns:
A string containing the request method (e.g., GET), the URL, and the protocol, separated by spaces

resultCode

public int resultCode()
Get the result code returned by the server. Among HTTP result codes, 200 is the "normal" reply, while 403 indicates a permission failure and 404 indicates a URL was not found.

Returns:
the result code

referrer

public String referrer()
Get the URL of the "referrer" containing the link used to make the request.

Returns:
the referring URL as a string

browser

public String browser()
Get the identification information for the browser making the request.

Returns:
the browser identification information as a string

toString

public String toString()
Create a string representation of the data. This is not necessarily identical with the text of the original log line.

Overrides:
toString in class Object
Returns:
A string representing the data of this entry.

Last updated: Wed, Apr 1, 2009 • 12:29 AM EDT

Copyright © 2009 Virginia Tech.