org.apache.jmeter.protocol.http.proxy

## Class ProxyControl

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.control.GenericController
    - - org.apache.jmeter.protocol.http.proxy.ProxyControl

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Controller, Searchable, NonTestElement, TestElement, TestCompilerHelper

      public class ProxyControl
      extends GenericController
      implements NonTestElement

  Class handles storing of generated samples, etc For unit tests, see TestProxyControl
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ProxyControl.KeystoreMode`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CERT_VALIDITY`
    `static int` | `DEFAULT_PORT`
    `static java.lang.String` | `DEFAULT_PORT_S`

    - ### Fields inherited from class org.apache.jmeter.control.GenericController

      `current, subControllersAndSamplers`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProxyControl()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConfigElement(ConfigElement config)`
    `void` | `addExcludedPattern(java.lang.String pattern)`
    `void` | `addIncludedPattern(java.lang.String pattern)`
    `boolean` | `canRemove()` Called by Remove to determine if it is safe to remove the element.
    `void` | `clearExcludedPatterns()`
    `void` | `clearIncludedPatterns()`
    `void` | `deliverSampler(HTTPSamplerBase sampler, TestElement[] testElements, SampleResult result)` Receives the recorded sampler from the proxy server for placing in the test tree; this is skipped if the sampler is null (e.g. for recording SSL errors) Always sends the result to any registered sample listeners.
    `JMeterTreeNode` | `findTargetControllerNode()` Finds the controller where samplers have to be stored, that is: The controller specified by the `target` property.
    `boolean` | `getAssertions()`
    `boolean` | `getCaptureHttpHeaders()`
    `java.lang.String[]` | `getCertificateDetails()`
    `java.lang.String` | `getContentTypeExclude()`
    `java.lang.String` | `getContentTypeInclude()`
    `int` | `getDefaultPort()`
    `CollectionProperty` | `getExcludePatterns()`
    `int` | `getGroupingMode()`
    `int` | `getHTTPSampleNamingMode()`
    `CollectionProperty` | `getIncludePatterns()`
    `JMeterTreeModel` | `getNonGuiTreeModel()`
    `boolean` | `getNotifyChildSamplerListenerOfFilteredSamplers()`
    `int` | `getPort()`
    `java.lang.String` | `getPortString()`
    `java.lang.String` | `getPrefixHTTPSampleName()`
    `java.lang.String` | `getProxyPauseHTTPSample()`
    `boolean` | `getRegexMatch()`
    `boolean` | `getSamplerDownloadImages()`
    `boolean` | `getSamplerFollowRedirects()`
    `boolean` | `getSamplerRedirectAutomatically()`
    `java.lang.String` | `getSamplerTypeName()`
    `java.lang.String` | `getSslDomains()`
    `JMeterTreeNode` | `getTarget()`
    `boolean` | `getUseKeepalive()`
    `static boolean` | `isDynamicMode()`
    `void` | `setAssertions(boolean b)`
    `void` | `setCaptureHttpHeaders(boolean capture)`
    `void` | `setContentTypeExclude(java.lang.String contentTypeExclude)`
    `void` | `setContentTypeInclude(java.lang.String contentTypeInclude)`
    `void` | `setExcludeList(java.util.Collection<java.lang.String> list)`
    `void` | `setGroupingMode(int grouping)`
    `void` | `setHTTPSampleNamingMode(int httpNamingMode)`
    `void` | `setIncludeList(java.util.Collection<java.lang.String> list)`
    `void` | `setNonGuiTreeModel(JMeterTreeModel treeModel)` Set a `JMeterTreeModel` to be used by the ProxyControl, when used in a non-GUI environment, where the `JMeterTreeModel` can't be acquired through `GuiPackage.getTreeModel()`
    `void` | `setNotifyChildSamplerListenerOfFilteredSamplers(boolean b)`
    `void` | `setPort(int port)`
    `void` | `setPort(java.lang.String port)`
    `void` | `setPrefixHTTPSampleName(java.lang.String prefixHTTPSampleName)`
    `void` | `setProxyPauseHTTPSample(java.lang.String proxyPauseHTTPSample)`
    `void` | `setRegexMatch(boolean b)`
    `void` | `setSamplerDownloadImages(boolean b)`
    `void` | `setSamplerFollowRedirects(boolean b)`
    `void` | `setSamplerRedirectAutomatically(boolean b)`
    `void` | `setSamplerTypeName(java.lang.String samplerTypeName)`
    `void` | `setSslDomains(java.lang.String domains)`
    `void` | `setTarget(JMeterTreeNode target)` Sets the target node where the samples generated by the proxy have to be stored.
    `void` | `setUseKeepAlive(boolean b)`
    `void` | `startProxy()`
    `void` | `stopProxy()`

    - ### Methods inherited from class org.apache.jmeter.control.GenericController

      `addIterationListener, addTestElement, addTestElementOnce, currentReturnedNull, fireIterationStart, fireIterEvents, getCurrentElement, getIterCount, getSubControllers, incrementCurrent, incrementIterCount, initialize, initializeSubControllers, isDone, isFirst, next, nextIsAController, nextIsASampler, nextIsNull, readResolve, reInitialize, removeCurrentElement, removeIterationListener, resetCurrent, resetIterCount, setCurrentElement, setDone, setFirst, triggerEndOfLoop`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Field Detail

    - #### DEFAULT_PORT

          public static final int DEFAULT_PORT

      See Also:
        Constant Field Values

    - #### DEFAULT_PORT_S

          public static final java.lang.String DEFAULT_PORT_S

    - #### CERT_VALIDITY

          public static final int CERT_VALIDITY

  - ### Constructor Detail

    - #### ProxyControl

          public ProxyControl()

  - ### Method Detail

    - #### setNonGuiTreeModel

          public void setNonGuiTreeModel(JMeterTreeModel treeModel)

      Set a `JMeterTreeModel` to be used by the ProxyControl, when used in a non-GUI environment, where the `JMeterTreeModel` can't be acquired through `GuiPackage.getTreeModel()`
      Parameters:
        `treeModel` - the `JMeterTreeModel` to be used, or `null` when the GUI model should be used

    - #### setPort

          public void setPort(int port)

    - #### setPort

          public void setPort(java.lang.String port)

    - #### setSslDomains

          public void setSslDomains(java.lang.String domains)

    - #### getSslDomains

          public java.lang.String getSslDomains()

    - #### setCaptureHttpHeaders

          public void setCaptureHttpHeaders(boolean capture)

    - #### setGroupingMode

          public void setGroupingMode(int grouping)

    - #### setAssertions

          public void setAssertions(boolean b)

    - #### setSamplerTypeName

          public void setSamplerTypeName(java.lang.String samplerTypeName)

    - #### setSamplerRedirectAutomatically

          public void setSamplerRedirectAutomatically(boolean b)

    - #### setSamplerFollowRedirects

          public void setSamplerFollowRedirects(boolean b)

    - #### setUseKeepAlive

          public void setUseKeepAlive(boolean b)

      Parameters:
        `b` - flag whether keep alive should be used

    - #### setSamplerDownloadImages

          public void setSamplerDownloadImages(boolean b)

    - #### setHTTPSampleNamingMode

          public void setHTTPSampleNamingMode(int httpNamingMode)

    - #### setPrefixHTTPSampleName

          public void setPrefixHTTPSampleName(java.lang.String prefixHTTPSampleName)

    - #### setProxyPauseHTTPSample

          public void setProxyPauseHTTPSample(java.lang.String proxyPauseHTTPSample)

    - #### setNotifyChildSamplerListenerOfFilteredSamplers

          public void setNotifyChildSamplerListenerOfFilteredSamplers(boolean b)

    - #### setIncludeList

          public void setIncludeList(java.util.Collection<java.lang.String> list)

    - #### setExcludeList

          public void setExcludeList(java.util.Collection<java.lang.String> list)

    - #### setRegexMatch

          public void setRegexMatch(boolean b)

      Parameters:
        `b` - flag whether regex matching should be used

    - #### setContentTypeExclude

          public void setContentTypeExclude(java.lang.String contentTypeExclude)

    - #### setContentTypeInclude

          public void setContentTypeInclude(java.lang.String contentTypeInclude)

    - #### getAssertions

          public boolean getAssertions()

    - #### getGroupingMode

          public int getGroupingMode()

    - #### getPort

          public int getPort()

    - #### getPortString

          public java.lang.String getPortString()

    - #### getDefaultPort

          public int getDefaultPort()

    - #### getCaptureHttpHeaders

          public boolean getCaptureHttpHeaders()

    - #### getSamplerTypeName

          public java.lang.String getSamplerTypeName()

    - #### getSamplerRedirectAutomatically

          public boolean getSamplerRedirectAutomatically()

    - #### getSamplerFollowRedirects

          public boolean getSamplerFollowRedirects()

    - #### getUseKeepalive

          public boolean getUseKeepalive()

    - #### getSamplerDownloadImages

          public boolean getSamplerDownloadImages()

    - #### getHTTPSampleNamingMode

          public int getHTTPSampleNamingMode()

    - #### getPrefixHTTPSampleName

          public java.lang.String getPrefixHTTPSampleName()

    - #### getProxyPauseHTTPSample

          public java.lang.String getProxyPauseHTTPSample()

    - #### getNotifyChildSamplerListenerOfFilteredSamplers

          public boolean getNotifyChildSamplerListenerOfFilteredSamplers()

    - #### getRegexMatch

          public boolean getRegexMatch()

    - #### getContentTypeExclude

          public java.lang.String getContentTypeExclude()

    - #### getContentTypeInclude

          public java.lang.String getContentTypeInclude()

    - #### getNonGuiTreeModel

          public JMeterTreeModel getNonGuiTreeModel()

      Returns:
        the `JMeterTreeModel` used when run in non-GUI mode, or `null` when run in GUI mode

    - #### addConfigElement

          public void addConfigElement(ConfigElement config)

    - #### startProxy

          public void startProxy()
                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### addExcludedPattern

          public void addExcludedPattern(java.lang.String pattern)

    - #### getExcludePatterns

          public CollectionProperty getExcludePatterns()

    - #### addIncludedPattern

          public void addIncludedPattern(java.lang.String pattern)

    - #### getIncludePatterns

          public CollectionProperty getIncludePatterns()

    - #### clearExcludedPatterns

          public void clearExcludedPatterns()

    - #### clearIncludedPatterns

          public void clearIncludedPatterns()

    - #### getTarget

          public JMeterTreeNode getTarget()

      Returns:
        the target controller node

    - #### setTarget

          public void setTarget(JMeterTreeNode target)

      Sets the target node where the samples generated by the proxy have to be stored.
      Parameters:
        `target` - target node to store generated samples

    - #### deliverSampler

          public void deliverSampler(HTTPSamplerBase sampler,
                                     TestElement[] testElements,
                                     SampleResult result)

      Receives the recorded sampler from the proxy server for placing in the test tree; this is skipped if the sampler is null (e.g. for recording SSL errors) Always sends the result to any registered sample listeners.
      Parameters:
        `sampler` - the sampler, may be null
        `testElements` - the test elements to be added (e.g. header manager) under the Sampler
        `result` - the sample result, not null TODO param serverResponse to be added to allow saving of the server's response while recording.

    - #### stopProxy

          public void stopProxy()

    - #### getCertificateDetails

          public java.lang.String[] getCertificateDetails()

    - #### findTargetControllerNode

          public JMeterTreeNode findTargetControllerNode()

      Finds the controller where samplers have to be stored, that is:
      - The controller specified by the `target` property.
      - If none was specified, the first RecordingController in the tree.
      - If none is found, the first AbstractThreadGroup in the tree.
      Returns:
        the tree node for the controller where the proxy must store the generated samplers.

    - #### canRemove

          public boolean canRemove()

      Description copied from class: `AbstractTestElement`
      Called by Remove to determine if it is safe to remove the element. The element can either clean itself up, and return true, or the element can return false.
      Specified by:
        `canRemove` in interface `TestElement`
      Overrides:
        `canRemove` in class `AbstractTestElement`
      Returns:
        true if safe to remove the element

    - #### isDynamicMode

          public static boolean isDynamicMode()

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