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 SummaryFields inherited from class org.apache.jmeter.protocol.http.proxy.AbstractSamplerCreatorDEFAULT_ENCODING_KEY, HTTP, HTTPS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.AbstractSamplerCreatorcreateAndPopulateSampler, createChildren, getBinaryDirectory, getBinaryFileSuffix, getRequestNumber, incrementRequestNumber, incrementRequestNumberAndGet, isBinaryContent, isNumberRequests, postProcessSampler, setCounter
- 
Constructor Details- 
DefaultSamplerCreatorpublic DefaultSamplerCreator()
 
- 
- 
Method Details- 
getManagedContentTypes- Returns:
- String[] array of Content types managed by Factory
- See Also:
 
- 
createSamplerpublic HTTPSamplerBase createSampler(HttpRequestHdr request, Map<String, String> pageEncodings, Map<String, String> formEncodings) Description copied from interface:SamplerCreatorCreate HTTPSamplerBase- Parameters:
- request-- HttpRequestHdr
- pageEncodings- Map of page encodings
- formEncodings- Map of form encodings
- Returns:
- HTTPSamplerBase
- See Also:
 
- 
populateSamplerpublic 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-- HTTPSamplerBase
- request-- HttpRequestHdr
- pageEncodings- Map of page encodings
- formEncodings- Map of form encodings
- Throws:
- Exception- when something fails
- See Also:
 
- 
computeFromHeaderprotected 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 encodings
- formEncodings- Map of form encodings
- Throws:
- Exception- when something fails
 
- 
computeFromPostBodyprotected void computeFromPostBody(HTTPSamplerBase sampler, HttpRequestHdr request) throws Exception Compute sampler information from Request Header- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
- Throws:
- Exception- when something fails
 
- 
isPotentialJsonTries parsing to see if content is JSON- Parameters:
- postData- String
- Returns:
- boolean
 
- 
computeSamplerNameCompute sampler name- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
- 
computePathSet path on sampler- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
- 
computeContentEncodingprotected 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 encodings
- formEncodings- Map of form encodings
- Throws:
- MalformedURLException- when no- URLcould be built from- samplerand- request
 
- 
computeContentEncodingprotected 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 encodings
- formEncodings- Map of form encodings
- urlWithoutQuery- the request URL without the query parameters
- Returns:
- String content encoding
 
- 
computeProtocolSet protocol on sampler- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
- 
computePortSet Port on sampler- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
- 
computeMethodSet method on sampler- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
- 
computeDomainSet domain on sampler- Parameters:
- sampler-- HTTPSamplerBase
- request-- HttpRequestHdr
 
 
-