|
Apache JMeter 2.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.samplers.AbstractSampler
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
Common constants and methods for HTTP samplers
Fields inherited from interface org.apache.jmeter.testelement.TestElement |
ENABLED, GUI_CLASS, NAME, TEST_CLASS |
Constructor Summary | |
HTTPSamplerBase()
|
Method Summary | |
void |
addArgument(String name,
String value)
|
void |
addArgument(String name,
String value,
String metadata)
|
void |
addEncodedArgument(String name,
String value)
Add an argument which has already been encoded |
void |
addEncodedArgument(String name,
String value,
String metaData)
|
void |
addTestElement(TestElement el)
|
Object |
clone()
|
protected HTTPSampleResult |
downloadPageResources(HTTPSampleResult res,
HTTPSampleResult container,
int frameDepth)
Download the resources of an HTML page. |
protected static String |
encodeBackSlashes(String value)
|
protected String |
encodeSpaces(String path)
|
protected HTTPSampleResult |
errorResult(Throwable e,
HTTPSampleResult res)
Obtain a result that will help inform the user that an error has occured during sampling, and how long it took to detect the error. |
protected HTTPSampleResult |
followRedirects(HTTPSampleResult res,
int frameDepth)
Iteratively download the redirect targets of a redirect response. |
Arguments |
getArguments()
|
AuthManager |
getAuthManager()
|
boolean |
getAutoRedirects()
|
CookieManager |
getCookieManager()
|
static int |
getDefaultPort(String protocol,
int port)
|
String |
getDomain()
|
String |
getFileField()
|
String |
getFilename()
|
boolean |
getFollowRedirects()
|
HeaderManager |
getHeaderManager()
|
String |
getImplementation()
|
String |
getMethod()
|
String |
getMimetype()
|
String |
getMonitor()
|
String |
getPath()
|
int |
getPort()
|
String |
getProtocol()
|
String |
getQueryString()
Gets the QueryString attribute of the UrlConfig object. |
URL |
getUrl()
Get the URL, built from its component parts. |
boolean |
getUseKeepAlive()
|
static String[] |
getValidMethodsAsArray()
|
boolean |
isImageParser()
|
boolean |
isMonitor()
|
static boolean |
isSecure(String protocol)
|
static boolean |
isSecure(URL url)
|
protected boolean |
isSuccessCode(int code)
Determine if the HTTP status code is successful or not i.e. in range 200 to 399 inclusive |
void |
parseArguments(String queryString)
This method allows a proxy server to send over the raw text from a browser's output stream to be parsed and stored correctly into the UrlConfig object. |
protected HTTPSampleResult |
resultProcessing(boolean areFollowingRedirect,
int frameDepth,
HTTPSampleResult res)
Follow redirects and download page resources if appropriate. this works, but the container stuff here is what's doing it. followRedirects() is actually doing the work to make sure we have only one container to make this work more naturally, I think this method - sample() - needs to take an HTTPSamplerResult container parameter instead of a boolean:areFollowingRedirect. |
SampleResult |
sample()
Perform a sample, and return the results |
SampleResult |
sample(Entry e)
Do a sampling and return its results. |
protected abstract HTTPSampleResult |
sample(URL u,
String method,
boolean areFollowingRedirect,
int depth)
Samples the URL passed in and stores the result in HTTPSampleResult , following redirects and downloading
page resources as appropriate.
|
void |
setArguments(Arguments value)
|
void |
setAuthManager(AuthManager value)
|
void |
setAutoRedirects(boolean value)
|
void |
setCookieManager(CookieManager value)
|
void |
setDomain(String value)
|
void |
setFileField(String value)
|
void |
setFilename(String value)
|
void |
setFollowRedirects(boolean value)
|
void |
setHeaderManager(HeaderManager value)
|
void |
setImageParser(boolean parseImages)
|
void |
setImplementation(String value)
|
void |
setMethod(String value)
|
void |
setMimetype(String value)
|
void |
setMonitor(boolean truth)
|
void |
setMonitor(String value)
|
void |
setPath(String path)
Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments |
void |
setPort(int value)
|
void |
setProtocol(String value)
|
void |
setUseKeepAlive(boolean value)
|
void |
testEnded()
Called once for all threads after the end of a test |
void |
testEnded(String host)
|
void |
testIterationStart(LoopIterationEvent event)
Each time through a Thread Group's test script, an iteration event is fired. |
void |
testStarted()
Called just before the start of the test Note that not all the test variables will have been set up at this point. |
void |
testStarted(String host)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.jmeter.testelement.TestElement |
canRemove, clear, getProperty, getPropertyAsBoolean, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse |
Field Detail |
public static final int DEFAULT_HTTPS_PORT
public static final int DEFAULT_HTTP_PORT
public static final String DEFAULT_HTTP_PORT_STRING
public static final String ARGUMENTS
public static final String AUTH_MANAGER
public static final String COOKIE_MANAGER
public static final String HEADER_MANAGER
public static final String MIMETYPE
public static final String DOMAIN
public static final String PORT
public static final String METHOD
public static final String IMPLEMENTATION
public static final String PATH
public static final String FOLLOW_REDIRECTS
public static final String AUTO_REDIRECTS
public static final String PROTOCOL
public static final String PROTOCOL_HTTP
public static final String PROTOCOL_HTTPS
public static final String DEFAULT_PROTOCOL
public static final String URL
public static final String HEAD
public static final String POST
public static final String PUT
public static final String GET
public static final String OPTIONS
public static final String TRACE
public static final String DELETE
public static final String DEFAULT_METHOD
public static final List METHODLIST
public static final String USE_KEEPALIVE
public static final String FILE_NAME
public static final String FILE_FIELD
public static final String FILE_DATA
public static final String FILE_MIMETYPE
public static final String CONTENT_TYPE
public static final String NORMAL_FORM
public static final String MULTIPART_FORM
public static final String IMAGE_PARSER
public static final String MONITOR
public static final int UNSPECIFIED_PORT
public static final String UNSPECIFIED_PORT_AS_STRING
protected static final String NON_HTTP_RESPONSE_CODE
protected static final String NON_HTTP_RESPONSE_MESSAGE
protected static final int MAX_REDIRECTS
protected static final int MAX_FRAME_DEPTH
protected static final String HEADER_AUTHORIZATION
protected static final String HEADER_COOKIE
protected static final String HEADER_CONNECTION
protected static final String CONNECTION_CLOSE
protected static final String KEEP_ALIVE
protected static final String TRANSFER_ENCODING
protected static final String HTTP_1_1
protected static final String HEADER_SET_COOKIE
protected static final String ENCODING_GZIP
protected static final String HEADER_CONTENT_DISPOSITION
protected static final String HEADER_CONTENT_TYPE
protected static final String HEADER_CONTENT_LENGTH
protected static final String HEADER_LOCATION
Constructor Detail |
public HTTPSamplerBase()
Method Detail |
public void setFileField(String value)
public String getFileField()
public void setFilename(String value)
public String getFilename()
public void setProtocol(String value)
public String getProtocol()
public void setPath(String path)
path
- The new Path valuepublic String getPath()
public void setFollowRedirects(boolean value)
public boolean getFollowRedirects()
public void setAutoRedirects(boolean value)
public boolean getAutoRedirects()
public void setMethod(String value)
public String getMethod()
public void setUseKeepAlive(boolean value)
public boolean getUseKeepAlive()
public void setMonitor(String value)
public void setMonitor(boolean truth)
public String getMonitor()
public boolean isMonitor()
public void setImplementation(String value)
public String getImplementation()
public void addEncodedArgument(String name, String value)
public void addEncodedArgument(String name, String value, String metaData)
public void addArgument(String name, String value)
public void addArgument(String name, String value, String metadata)
public void addTestElement(TestElement el)
addTestElement
in interface TestElement
addTestElement
in class AbstractTestElement
public void setPort(int value)
public static int getDefaultPort(String protocol, int port)
public int getPort()
public void setDomain(String value)
public String getDomain()
public void setArguments(Arguments value)
public Arguments getArguments()
public void setAuthManager(AuthManager value)
public AuthManager getAuthManager()
public void setHeaderManager(HeaderManager value)
public HeaderManager getHeaderManager()
public void setCookieManager(CookieManager value)
public CookieManager getCookieManager()
public void setMimetype(String value)
public String getMimetype()
public boolean isImageParser()
public void setImageParser(boolean parseImages)
protected HTTPSampleResult errorResult(Throwable e, HTTPSampleResult res)
e
- Exception representing the error.
public URL getUrl() throws MalformedURLException
MalformedURLException
public String getQueryString()
public void parseArguments(String queryString)
queryString
- -
the query stringpublic String toString()
public SampleResult sample(Entry e)
sample
in interface Sampler
e
- Entry
to be sampled
public SampleResult sample()
protected abstract HTTPSampleResult sample(URL u, String method, boolean areFollowingRedirect, int depth)
HTTPSampleResult
, following redirects and downloading
page resources as appropriate.
When getting a redirect target, redirects are not followed and resources are not downloaded. The caller will take care of this.
method
- HTTP method: GET, POST,...areFollowingRedirect
- whether we're getting a redirect target
protected HTTPSampleResult downloadPageResources(HTTPSampleResult res, HTTPSampleResult container, int frameDepth)
If createContainerResult is true, the returned result will contain one subsample for each request issued, including the original one that was passed in. It will otherwise look exactly like that original one.
If createContainerResult is false, one subsample will be added to the provided result for each requests issued.
res
- result of the initial request - must contain an HTML responsecontainer
- for storing the resultsframeDepth
- Depth of this target in the frame structure. Used only to
prevent infinite recursion.
protected String encodeSpaces(String path)
public void testEnded()
TestListener
testEnded
in interface TestListener
StandardJMeterEngine.stopTest()
public void testEnded(String host)
testEnded
in interface TestListener
public void testIterationStart(LoopIterationEvent event)
TestListener
testIterationStart
in interface TestListener
event
- public void testStarted()
TestListener
testStarted
in interface TestListener
StandardJMeterEngine.run()
public void testStarted(String host)
testStarted
in interface TestListener
public Object clone()
clone
in interface TestElement
clone
in class AbstractTestElement
protected HTTPSampleResult followRedirects(HTTPSampleResult res, int frameDepth)
The returned result will contain one subsample for each request issued, including the original one that was passed in. It will be an HTTPSampleResult that should mostly look as if the final destination of the redirect chain had been obtained in a single shot.
res
- result of the initial request - must be a redirect responseframeDepth
- Depth of this target in the frame structure. Used only to
prevent infinite recursion.
protected HTTPSampleResult resultProcessing(boolean areFollowingRedirect, int frameDepth, HTTPSampleResult res)
areFollowingRedirect
- frameDepth
- res
-
protected boolean isSuccessCode(int code)
protected static String encodeBackSlashes(String value)
public static String[] getValidMethodsAsArray()
public static boolean isSecure(String protocol)
public static boolean isSecure(URL url)
|
Apache JMeter 2.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |