Apache JMeter
2.0.1.20050615

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

public class HTTPSampler2
extends HTTPSamplerBase

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

Version:
$Revision: 1.8.2.9 $ Last updated $Date: 2004/10/27 23:09:09 $
See Also:
Serialized Form

Nested Class Summary
static class HTTPSampler2.Test
           
 
Field Summary
 
Fields inherited from class org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
ARGUMENTS, AUTH_MANAGER, AUTO_REDIRECTS, CONTENT_TYPE, COOKIE_MANAGER, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, DEFAULT_PROTOCOL, DOMAIN, FILE_DATA, FILE_FIELD, FILE_MIMETYPE, FILE_NAME, FOLLOW_REDIRECTS, GET, HEADER_MANAGER, IMAGE_PARSER, MAX_FRAME_DEPTH, MAX_REDIRECTS, METHOD, MIMETYPE, MONITOR, MULTIPART_FORM, NON_HTTP_RESPONSE_CODE, NON_HTTP_RESPONSE_MESSAGE, NORMAL_FORM, PATH, PORT, POST, PROTOCOL, UNSPECIFIED_PORT, 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 sendPostData(org.apache.commons.httpclient.methods.PostMethod post, HTTPSampler2 sampler)
          Send POST data from Entry to the open connection.
 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, addTestElement, clone, downloadPageResources, encodeSpaces, errorResult, getArguments, getAuthManager, getCookieManager, getDomain, getFileField, getFilename, getFollowRedirects, getHeaderManager, getMethod, getMimetype, getMonitor, getPath, getPort, getProtocol, getQueryString, getUrl, getUseKeepAlive, isImageParser, isMonitor, parseArguments, sample, sample, setArguments, setAuthManager, setCookieManager, setDomain, setFileField, setFilename, setFollowRedirects, setHeaderManager, setImageParser, setMethod, setMimetype, 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, getThreadContext, getThreadName, 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, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
 

Constructor Detail

HTTPSampler2

public HTTPSampler2()
Constructor for the HTTPSampler2 object.

Method Detail

sendPostData

public void sendPostData(org.apache.commons.httpclient.methods.PostMethod post,
                         HTTPSampler2 sampler)
                  throws IOException
Send POST data from Entry to the open connection.

Throws:
IOException

getResponseHeaders

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

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

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.0.1.20050615

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