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
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 typeprotected void
computeContentEncoding
(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Compute content encodingprotected void
computeDomain
(HTTPSamplerBase sampler, HttpRequestHdr request) Set domain on samplerprotected void
computeFromHeader
(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Compute sampler information from Request Headerprotected void
computeFromPostBody
(HTTPSamplerBase sampler, HttpRequestHdr request) Compute sampler information from Request Headerprotected void
computeMethod
(HTTPSamplerBase sampler, HttpRequestHdr request) Set method on samplerprotected void
computePath
(HTTPSamplerBase sampler, HttpRequestHdr request) Set path on samplerprotected void
computePort
(HTTPSamplerBase sampler, HttpRequestHdr request) Set Port on samplerprotected void
computeProtocol
(HTTPSamplerBase sampler, HttpRequestHdr request) Set protocol on samplerprotected static void
computeSamplerName
(HTTPSamplerBase sampler, HttpRequestHdr request) Compute sampler namecreateSampler
(HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Create HTTPSamplerBaseString[]
static boolean
isPotentialJson
(String postData) Tries parsing to see if content is JSONfinal void
populateSampler
(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:SamplerCreator
Create HTTPSamplerBase- Parameters:
request
-HttpRequestHdr
pageEncodings
- 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:SamplerCreator
Populate sampler from request- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
pageEncodings
- 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
-HTTPSamplerBase
request
-HttpRequestHdr
pageEncodings
- 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
-HTTPSamplerBase
request
-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
-HTTPSamplerBase
request
-HttpRequestHdr
-
computePath
Set path on sampler- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
-
computeContentEncoding
protected void computeContentEncoding(HTTPSamplerBase sampler, HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, throws MalformedURLExceptionString> formEncodings) Compute content encoding- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
pageEncodings
- Map of page encodingsformEncodings
- Map of form encodings- Throws:
MalformedURLException
- when noURL
could be built fromsampler
andrequest
-
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 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
-HTTPSamplerBase
request
-HttpRequestHdr
-
computePort
Set Port on sampler- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
-
computeMethod
Set method on sampler- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
-
computeDomain
Set domain on sampler- Parameters:
sampler
-HTTPSamplerBase
request
-HttpRequestHdr
-