Class DefaultSamplerCreator
java.lang.Object
org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreator
org.apache.jmeter.protocol.http.proxy.DefaultSamplerCreator
- All Implemented Interfaces:
SamplerCreator
@AutoService(SamplerCreator.class)
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
DEFAULT_ENCODING_KEY, HTTP, HTTPS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcomputeContentEncoding(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 typeprotected voidcomputeContentEncoding(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Compute content encodingprotected voidcomputeDomain(HTTPSamplerBase sampler, HttpRequestHdr request) Set domain on samplerprotected voidcomputeFromHeader(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Compute sampler information from Request Headerprotected voidcomputeFromPostBody(HTTPSamplerBase sampler, HttpRequestHdr request) Compute sampler information from Request Headerprotected voidcomputeMethod(HTTPSamplerBase sampler, HttpRequestHdr request) Set method on samplerprotected voidcomputePath(HTTPSamplerBase sampler, HttpRequestHdr request) Set path on samplerprotected voidcomputePort(HTTPSamplerBase sampler, HttpRequestHdr request) Set Port on samplerprotected voidcomputeProtocol(HTTPSamplerBase sampler, HttpRequestHdr request) Set protocol on samplerprotected static voidcomputeSamplerName(HTTPSamplerBase sampler, HttpRequestHdr request) Compute sampler namecreateSampler(HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Create HTTPSamplerBaseString[]static booleanisPotentialJson(String postData) Tries parsing to see if content is JSONfinal voidpopulateSampler(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Populate sampler from requestMethods inherited from class org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreator
createAndPopulateSampler, createChildren, getBinaryDirectory, getBinaryFileSuffix, getRequestNumber, incrementRequestNumber, incrementRequestNumberAndGet, isBinaryContent, isNumberRequests, postProcessSampler, setCounter
-
Constructor Details
-
DefaultSamplerCreator
public DefaultSamplerCreator()
-
-
Method Details
-
getManagedContentTypes
- Returns:
- String[] array of Content types managed by Factory
- See Also:
-
createSampler
public HTTPSamplerBase createSampler(HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Description copied from interface:SamplerCreatorCreate HTTPSamplerBase- Parameters:
request-HttpRequestHdrpageEncodings- Map of page encodingsformEncodings- Map of form encodings- Returns:
HTTPSamplerBase- See Also:
-
populateSampler
public final void populateSampler(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, throws ExceptionString> formEncodings) Description copied from interface:SamplerCreatorPopulate sampler from request- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdrpageEncodings- Map of page encodingsformEncodings- Map of form encodings- Throws:
Exception- when something fails- See Also:
-
computeFromHeader
protected void computeFromHeader(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, throws ExceptionString> formEncodings) Compute sampler information from Request Header- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdrpageEncodings- Map of page encodingsformEncodings- Map of form encodings- Throws:
Exception- when something fails
-
computeFromPostBody
protected void computeFromPostBody(HTTPSamplerBase sampler, HttpRequestHdr request) throws Exception Compute sampler information from Request Header- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr- Throws:
Exception- when something fails
-
isPotentialJson
Tries parsing to see if content is JSON- Parameters:
postData- String- Returns:
- boolean
-
computeSamplerName
Compute sampler name- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-
computePath
Set path on sampler- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-
computeContentEncoding
protected void computeContentEncoding(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, throws MalformedURLExceptionString> formEncodings) Compute content encoding- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdrpageEncodings- Map of page encodingsformEncodings- Map of form encodings- Throws:
MalformedURLException- when noURLcould be built fromsamplerandrequest
-
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-HttpRequestHdrpageEncodings- Map of page encodingsformEncodings- Map of form encodingsurlWithoutQuery- the request URL without the query parameters- Returns:
- String content encoding
-
computeProtocol
Set protocol on sampler- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-
computePort
Set Port on sampler- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-
computeMethod
Set method on sampler- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-
computeDomain
Set domain on sampler- Parameters:
sampler-HTTPSamplerBaserequest-HttpRequestHdr
-