org.apache.jmeter.protocol.http.util.accesslog
public class TCLogParser extends Object implements LogParser
The parse algorithm is the following:
Extending this class is fairly simple. Most access logs use the same format starting from the request method. Therefore, changing the implementation of cleanURL(string) method should be sufficient to support new log formats. Tomcat uses common log format, so any webserver that uses the format should work with this parser. Servers that are known to use non standard formats are IIS and Netscape.
Modifier and Type | Field and Description |
---|---|
protected boolean |
decode
by default, we probably should decode the parameter values
|
protected String |
FILENAME |
protected Filter |
FILTER
Handles to supporting classes
|
static String |
GET |
static String |
HEAD |
protected static org.apache.log.Logger |
log |
static String |
POST |
protected BufferedReader |
READER |
protected String |
RMETHOD
protected members *
|
protected File |
SOURCE |
protected String |
URL_PATH
The path to the access log file
|
protected boolean |
useFILE |
Constructor and Description |
---|
TCLogParser() |
TCLogParser(String source) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkMethod(String text)
The method checks for POST and GET methods currently.
|
boolean |
checkParamFormat(String text)
Checks the string to see if it contains "&" and "=".
|
boolean |
checkURL(String url)
Checks the string to make sure it has /path/file?
|
String |
cleanURL(String entry)
The method cleans the URL using the following algorithm.
|
void |
close()
close the any streams or readers.
|
void |
convertStringToJMRequest(String text,
TestElement el)
Convert a single line into XML
|
NVPair[] |
convertStringtoNVPair(String stringparams)
Parse the string parameters into NVPair[] array.
|
boolean |
decodeParameterValue()
decode the parameter values is to true by default
|
protected int |
parse(BufferedReader breader,
TestElement el,
int parseCount)
The method is responsible for reading each line, and breaking out of the
while loop if a set number of lines is given.
|
int |
parse(TestElement el,
int parseCount)
parse the entire file.
|
int |
parseAndConfigure(int count,
TestElement el)
parse a set number of lines from the access log.
|
protected int |
parseLine(String line,
TestElement el)
parseLine calls the other parse methods to parse the given text.
|
protected NVPair |
parseOneParameter(String parameter)
Method expects name and value to be separated by an equal sign "=".
|
protected Vector<String> |
parseParameters(String parameters)
Method uses StringTokenizer to convert the string into single pairs.
|
void |
setDecodeParameterValues(boolean decodeparams)
by default decode is set to true. if the parameters shouldn't be
decoded, call the method with false
|
void |
setFilter(Filter filter)
Use the filter to include/exclude files in the access logs.
|
void |
setSourceFile(String source)
Sets the source file.
|
void |
setUseParsedFile(boolean file)
Calls this method to set whether or not to use the path in the log.
|
String |
stripFile(String url,
TestElement el)
Tokenize the URL into two tokens.
|
StringTokenizer |
tokenize(String line,
String delim)
Parses the line using java.util.StringTokenizer.
|
protected static final org.apache.log.Logger log
public static final String GET
public static final String POST
public static final String HEAD
protected String RMETHOD
protected String URL_PATH
protected boolean useFILE
protected File SOURCE
protected String FILENAME
protected BufferedReader READER
protected Filter FILTER
protected boolean decode
public TCLogParser()
public TCLogParser(String source)
source
- public void setDecodeParameterValues(boolean decodeparams)
decodeparams
- public boolean decodeParameterValue()
public void setUseParsedFile(boolean file)
file
- public void setFilter(Filter filter)
public void setSourceFile(String source)
setSourceFile
in interface LogParser
source
- public int parse(TestElement el, int parseCount)
public int parseAndConfigure(int count, TestElement el)
parseAndConfigure
in interface LogParser
count
- protected int parse(BufferedReader breader, TestElement el, int parseCount)
breader
- protected int parseLine(String line, TestElement el)
line
- public String cleanURL(String entry)
127.0.0.1 - - [08/Jan/2003:07:03:54 -0500] "GET /addrbook/ HTTP/1.1" 200 1981
entry
- public boolean checkMethod(String text)
text
- public String stripFile(String url, TestElement el)
url
- public boolean checkURL(String url)
url
- public boolean checkParamFormat(String text)
text
- public void convertStringToJMRequest(String text, TestElement el)
text
- public NVPair[] convertStringtoNVPair(String stringparams)
stringparams
- protected NVPair parseOneParameter(String parameter)
parameter
- to be parsedprotected Vector<String> parseParameters(String parameters)
parameters
- public StringTokenizer tokenize(String line, String delim)
line
- line to be parseddelim
- delimiterCopyright © 1998-2014 Apache Software Foundation. All Rights Reserved.