Apache JMeter

org.apache.jmeter.protocol.http.proxy
Class DefaultSamplerCreator

java.lang.Object
  extended by org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreator
      extended by org.apache.jmeter.protocol.http.proxy.DefaultSamplerCreator
All Implemented Interfaces:
SamplerCreator

public class DefaultSamplerCreator
extends AbstractSamplerCreator

Default implementation that handles classical HTTP textual + Multipart requests


Field Summary
 
Fields inherited from class org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreator
HTTP, HTTPS
 
Constructor Summary
DefaultSamplerCreator()
           
 
Method Summary
protected  String computeContentEncoding(HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings, String urlWithoutQuery)
          Computes content encoding from request and if not found uses pageEncoding and formEncoding to see if URL was previously computed with a content type
protected  void computeContentEncoding(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings)
          Compute content encoding
protected  void computeDomain(HTTPSamplerBase sampler, HttpRequestHdr request)
          Set domain on sampler
protected  void computeFromHeader(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings)
          Compute sampler informations from Request Header
protected  void computeFromPostBody(HTTPSamplerBase sampler, HttpRequestHdr request)
          Compute sampler informations from Request Header
protected  void computeMethod(HTTPSamplerBase sampler, HttpRequestHdr request)
          Set method on sampler
protected  void computePath(HTTPSamplerBase sampler, HttpRequestHdr request)
          Set path on sampler
protected  void computePort(HTTPSamplerBase sampler, HttpRequestHdr request)
          Set Port on sampler
protected  void computeProtocol(HTTPSamplerBase sampler, HttpRequestHdr request)
          Set protocol on sampler
protected  void computeSamplerName(HTTPSamplerBase sampler, HttpRequestHdr request)
          Compute sampler name
 HTTPSamplerBase createSampler(HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings)
          Create HTTPSamplerBase
 String[] getManagedContentTypes()
           
 void populateSampler(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings)
          Populate sampler from request
 
Methods inherited from class org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreator
createAndPopulateSampler, getBinaryDirectory, getBinaryFileSuffix, getRequestNumber, incrementRequestNumber, isBinaryContent, isNumberRequests, postProcessSampler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSamplerCreator

public DefaultSamplerCreator()
Method Detail

getManagedContentTypes

public String[] getManagedContentTypes()
Returns:
String[] array of Content types managed by Factory
See Also:
SamplerCreator.getManagedContentTypes()

createSampler

public HTTPSamplerBase createSampler(HttpRequestHdr request,
                                     Map<String,String> pageEncodings,
                                     Map<String,String> formEncodings)
Description copied from interface: SamplerCreator
Create HTTPSamplerBase

Parameters:
request - HttpRequestHdr
pageEncodings - Map
formEncodings - Map
Returns:
HTTPSamplerBase
See Also:
SamplerCreator.createSampler(org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, java.util.Map, java.util.Map)

populateSampler

public final void populateSampler(HTTPSamplerBase sampler,
                                  HttpRequestHdr request,
                                  Map<String,String> pageEncodings,
                                  Map<String,String> formEncodings)
                           throws Exception
Description copied from interface: SamplerCreator
Populate sampler from request

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr
pageEncodings - Map
formEncodings - Map
Throws:
Exception
See Also:
SamplerCreator.populateSampler(org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase, org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, java.util.Map, java.util.Map)

computeFromHeader

protected void computeFromHeader(HTTPSamplerBase sampler,
                                 HttpRequestHdr request,
                                 Map<String,String> pageEncodings,
                                 Map<String,String> formEncodings)
                          throws Exception
Compute sampler informations from Request Header

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr
pageEncodings - Map
formEncodings - Map
Throws:
Exception

computeFromPostBody

protected void computeFromPostBody(HTTPSamplerBase sampler,
                                   HttpRequestHdr request)
                            throws Exception
Compute sampler informations from Request Header

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr
Throws:
Exception

computeSamplerName

protected void computeSamplerName(HTTPSamplerBase sampler,
                                  HttpRequestHdr request)
Compute sampler name

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

computePath

protected void computePath(HTTPSamplerBase sampler,
                           HttpRequestHdr request)
Set path on sampler

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

computeContentEncoding

protected void computeContentEncoding(HTTPSamplerBase sampler,
                                      HttpRequestHdr request,
                                      Map<String,String> pageEncodings,
                                      Map<String,String> formEncodings)
                               throws MalformedURLException
Compute content encoding

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr
pageEncodings - Map
formEncodings - Map
Throws:
MalformedURLException

computeContentEncoding

protected String computeContentEncoding(HttpRequestHdr request,
                                        Map<String,String> pageEncodings,
                                        Map<String,String> formEncodings,
                                        String urlWithoutQuery)
Computes content encoding from request and if not found uses pageEncoding and formEncoding to see if URL was previously computed with a content type

Parameters:
request - HttpRequestHdr
pageEncodings - Map
formEncodings - Map
Returns:
String content encoding

computeProtocol

protected void computeProtocol(HTTPSamplerBase sampler,
                               HttpRequestHdr request)
Set protocol on sampler

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

computePort

protected void computePort(HTTPSamplerBase sampler,
                           HttpRequestHdr request)
Set Port on sampler

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

computeMethod

protected void computeMethod(HTTPSamplerBase sampler,
                             HttpRequestHdr request)
Set method on sampler

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

computeDomain

protected void computeDomain(HTTPSamplerBase sampler,
                             HttpRequestHdr request)
Set domain on sampler

Parameters:
sampler - HTTPSamplerBase
request - HttpRequestHdr

Apache JMeter

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