org.apache.jmeter.protocol.http.proxy

## Interface SamplerCreator

- All Known Implementing Classes:
    AbstractSamplerCreator, DefaultSamplerCreator

      public interface SamplerCreator

  Factory of sampler

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `HTTPSamplerBase` | `createAndPopulateSampler(HttpRequestHdr request, Map<String,String> pageEncodings, Map<String,String> formEncodings)` Default implementation calls: `SamplerCreator` `createSampler(HttpRequestHdr, Map, Map)` `SamplerCreator` `populateSampler(HTTPSamplerBase, HttpRequestHdr, Map, Map)`
    `List<TestElement>` | `createChildren(HTTPSamplerBase sampler, SampleResult result)` Create sampler children.
    `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
    `void` | `postProcessSampler(HTTPSamplerBase sampler, SampleResult result)` Post process sampler Called after sampling
    `default void` | `setCounter(int value)` Set the counter for this implementation.

- - ### Method Detail

    - #### getManagedContentTypes

          String[] getManagedContentTypes()

      Returns:
        String[] array of Content types managed by Factory

    - #### createSampler

          HTTPSamplerBase createSampler(HttpRequestHdr request,
                                        Map<String,String> pageEncodings,
                                        Map<String,String> formEncodings)

      Create HTTPSamplerBase
      Parameters:
        `request` - `HttpRequestHdr`
        `pageEncodings` - Map of page encodings
        `formEncodings` - Map of form encodings
      Returns:
        `HTTPSamplerBase`

    - #### populateSampler

          void populateSampler(HTTPSamplerBase sampler,
                               HttpRequestHdr request,
                               Map<String,String> pageEncodings,
                               Map<String,String> formEncodings)
                        throws Exception

      Populate sampler from request
      Parameters:
        `sampler` - `HTTPSamplerBase`
        `request` - `HttpRequestHdr`
        `pageEncodings` - Map of page encodings
        `formEncodings` - Map of form encodings
      Throws:
        `Exception` - when something fails

    - #### postProcessSampler

          void postProcessSampler(HTTPSamplerBase sampler,
                                  SampleResult result)

      Post process sampler Called after sampling
      Parameters:
        `sampler` - HTTPSamplerBase
        `result` - SampleResult
      Since:
        2.9

    - #### createAndPopulateSampler

          HTTPSamplerBase createAndPopulateSampler(HttpRequestHdr request,
                                                   Map<String,String> pageEncodings,
                                                   Map<String,String> formEncodings)
                                            throws Exception

      Default implementation calls:
      1. `SamplerCreator` `createSampler(HttpRequestHdr, Map, Map)`
      2. `SamplerCreator` `populateSampler(HTTPSamplerBase, HttpRequestHdr, Map, Map)`
      Parameters:
        `request` - `HttpRequestHdr`
        `pageEncodings` - Map of page encodings
        `formEncodings` - Map of form encodings
      Returns:
        `HTTPSamplerBase`
      Throws:
        `Exception` - when something fails
      Since:
        2.9

    - #### createChildren

          List<TestElement> createChildren(HTTPSamplerBase sampler,
                                           SampleResult result)

      Create sampler children. This method can be used to add PostProcessor or ResponseAssertions by implementations of `SamplerCreator`. Return empty list if nothing to create
      Parameters:
        `sampler` - `HTTPSamplerBase`
        `result` - `SampleResult`
      Returns:
        List

    - #### setCounter

          default void setCounter(int value)

      Set the counter for this implementation. The counter should be incremented before creating a new sampler by the implementation.
      Parameters:
        `value` - to be used

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