Apache JMeter
2.2

org.apache.jmeter.protocol.http.sampler
Class HTTPSampler2

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.samplers.AbstractSampler
          extended byorg.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
              extended byorg.apache.jmeter.protocol.http.sampler.HTTPSampler2
All Implemented Interfaces:
Cloneable, Sampler, Serializable, TestElement, TestListener
Direct Known Subclasses:
SoapSampler

public class HTTPSampler2
extends HTTPSamplerBase

A sampler which understands all the parts necessary to read statistics about HTTP requests, including cookies and authentication.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
ARGUMENTS, AUTH_MANAGER, AUTO_REDIRECTS, CONNECTION_CLOSE, CONTENT_TYPE, COOKIE_MANAGER, DEFAULT_HTTP_PORT, DEFAULT_HTTP_PORT_STRING, DEFAULT_HTTPS_PORT, DEFAULT_METHOD, DEFAULT_PROTOCOL, DELETE, DOMAIN, ENCODING_GZIP, FILE_DATA, FILE_FIELD, FILE_MIMETYPE, FILE_NAME, FOLLOW_REDIRECTS, GET, HEAD, HEADER_AUTHORIZATION, HEADER_CONNECTION, HEADER_CONTENT_DISPOSITION, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_COOKIE, HEADER_LOCATION, HEADER_MANAGER, HEADER_SET_COOKIE, HTTP_1_1, IMAGE_PARSER, IMPLEMENTATION, KEEP_ALIVE, MAX_FRAME_DEPTH, MAX_REDIRECTS, METHOD, METHODLIST, MIMETYPE, MONITOR, MULTIPART_FORM, NON_HTTP_RESPONSE_CODE, NON_HTTP_RESPONSE_MESSAGE, NORMAL_FORM, OPTIONS, PATH, PORT, POST, PROTOCOL, PROTOCOL_HTTP, PROTOCOL_HTTPS, PUT, TRACE, TRANSFER_ENCODING, UNSPECIFIED_PORT, UNSPECIFIED_PORT_AS_STRING, URL, USE_KEEPALIVE
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
HTTPSampler2()
          Constructor for the HTTPSampler2 object.
 
Method Summary
protected  String getResponseHeaders(org.apache.commons.httpclient.HttpMethod method)
          Gets the ResponseHeaders
protected  HTTPSampleResult sample(URL url, String method, boolean areFollowingRedirect, int frameDepth)
          Samples the URL passed in and stores the result in HTTPSampleResult, following redirects and downloading page resources as appropriate.
 void threadFinished()
          Called at the end of each thread.
 void threadStarted()
          Called at the start of each thread.
 
Methods inherited from class org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
addArgument, addArgument, addEncodedArgument, addEncodedArgument, addTestElement, clone, downloadPageResources, encodeBackSlashes, encodeSpaces, errorResult, followRedirects, getArguments, getAuthManager, getAutoRedirects, getCookieManager, getDefaultPort, getDomain, getFileField, getFilename, getFollowRedirects, getHeaderManager, getImplementation, getMethod, getMimetype, getMonitor, getPath, getPort, getProtocol, getQueryString, getUrl, getUseKeepAlive, getValidMethodsAsArray, isImageParser, isMonitor, isSecure, isSecure, isSuccessCode, parseArguments, resultProcessing, sample, sample, setArguments, setAuthManager, setAutoRedirects, setCookieManager, setDomain, setFileField, setFilename, setFollowRedirects, setHeaderManager, setImageParser, setImplementation, setMethod, setMimetype, setMonitor, setMonitor, setPath, setPort, setProtocol, setUseKeepAlive, testEnded, testEnded, testIterationStart, testStarted, testStarted, toString
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, canRemove, clear, clearTemporary, emptyTemporary, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
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, traverse
 

Constructor Detail

HTTPSampler2

public HTTPSampler2()
Constructor for the HTTPSampler2 object. Consider using HTTPSamplerFactory.newInstance() instead

Method Detail

getResponseHeaders

protected String getResponseHeaders(org.apache.commons.httpclient.HttpMethod method)
Gets the ResponseHeaders

Parameters:
method - connection from which the headers are read
Returns:
string containing the headers, one per line

sample

protected HTTPSampleResult sample(URL url,
                                  String method,
                                  boolean areFollowingRedirect,
                                  int frameDepth)
Samples the URL passed in and stores the result in 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.

Specified by:
sample in class HTTPSamplerBase
Parameters:
url - URL to sample
method - HTTP method: GET, POST,...
areFollowingRedirect - whether we're getting a redirect target
frameDepth - Depth of this target in the frame structure. Used only to prevent infinite recursion.
Returns:
results of the sampling

threadStarted

public void threadStarted()
Description copied from interface: TestElement
Called at the start of each thread. TODO - should it hava a parameter?

Specified by:
threadStarted in interface TestElement
Overrides:
threadStarted in class AbstractTestElement

threadFinished

public void threadFinished()
Description copied from interface: TestElement
Called at the end of each thread. TODO - should it hava a parameter?

Specified by:
threadFinished in interface TestElement
Overrides:
threadFinished in class AbstractTestElement

Apache JMeter
2.2

Copyright © 1998-2006 Apache Software Foundation. All Rights Reserved.