org.apache.jmeter.protocol.http.util

## Class HTTPArgument

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.config.Argument
    - - org.apache.jmeter.protocol.http.util.HTTPArgument

- All Implemented Interfaces:
    Serializable, Cloneable, Searchable, TestElement

      public class HTTPArgument
      extends Argument
      implements Serializable

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.jmeter.config.Argument

      `ARG_NAME, DESCRIPTION, METADATA, VALUE`

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

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTTPArgument()` Constructor for the Argument object
    `HTTPArgument(Argument arg)`
    `HTTPArgument(String name, String value)` Constructor for the Argument object.
    `HTTPArgument(String name, String value, boolean alreadyEncoded)`
    `HTTPArgument(String name, String value, boolean alreadyEncoded, String contentEncoding)` Construct a new HTTPArgument instance; alwaysEncoded is set to true.
    `HTTPArgument(String name, String value, String metadata)` Constructor for the Argument object.
    `HTTPArgument(String name, String value, String metaData, boolean alreadyEncoded)` Construct a new HTTPArgument instance
    `HTTPArgument(String name, String value, String metaData, boolean alreadyEncoded, String contentEncoding)` Construct a new HTTPArgument instance

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `convertArgumentsToHTTP(Arguments args)` Converts all `Argument` entries in the collection to `HTTPArgument` entries.
    `String` | `getContentType()`
    `String` | `getEncodedName()`
    `String` | `getEncodedValue()` Get the argument value encoded using UTF-8
    `String` | `getEncodedValue(String contentEncoding)` Get the argument value encoded in the specified encoding
    `boolean` | `isAlwaysEncoded()`
    `boolean` | `isUseEquals()`
    `void` | `setAlwaysEncoded(boolean ae)`
    `void` | `setContentType(String ct)`
    `void` | `setName(String newName)` Sets the Name attribute of the Argument object.
    `void` | `setUseEquals(boolean ue)`

    - ### Methods inherited from class org.apache.jmeter.config.Argument

      `getDescription, getMetaData, getName, getValue, isSkippable, setDescription, setMetaData, setValue, toString`

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

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, 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, 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, wait, wait, wait`

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

      `removed`

- - ### Constructor Detail

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value,
                              String metadata)

      Constructor for the Argument object.

      The value is assumed to be not encoded.

      Parameters:
        `name` - name of the parameter
        `value` - value of the parameter
        `metadata` - the separator to use between name and value

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value)

      Constructor for the Argument object.

      The value is assumed to be not encoded.

      Parameters:
        `name` - name of the parameter
        `value` - value of the parameter

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value,
                              boolean alreadyEncoded)

      Parameters:
        `name` - name of the parameter
        `value` - value of the parameter
        `alreadyEncoded` - `true` if the value is already encoded, in which case they are decoded before storage

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value,
                              boolean alreadyEncoded,
                              String contentEncoding)

      Construct a new HTTPArgument instance; alwaysEncoded is set to true.
      Parameters:
        `name` - the name of the parameter
        `value` - the value of the parameter
        `alreadyEncoded` - true if the name and value is already encoded, in which case they are decoded before storage.
        `contentEncoding` - the encoding used for the parameter value

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value,
                              String metaData,
                              boolean alreadyEncoded)

      Construct a new HTTPArgument instance
      Parameters:
        `name` - the name of the parameter
        `value` - the value of the parameter
        `metaData` - the separator to use between name and value
        `alreadyEncoded` - true if the name and value is already encoded

    - #### HTTPArgument

          public HTTPArgument(String name,
                              String value,
                              String metaData,
                              boolean alreadyEncoded,
                              String contentEncoding)

      Construct a new HTTPArgument instance
      Parameters:
        `name` - the name of the parameter
        `value` - the value of the parameter
        `metaData` - the separator to use between name and value
        `alreadyEncoded` - true if the name and value is already encoded
        `contentEncoding` - the encoding used for the parameter value

    - #### HTTPArgument

          public HTTPArgument(Argument arg)

    - #### HTTPArgument

          public HTTPArgument()

      Constructor for the Argument object

  - ### Method Detail

    - #### setUseEquals

          public void setUseEquals(boolean ue)

    - #### isUseEquals

          public boolean isUseEquals()

    - #### setContentType

          public void setContentType(String ct)

    - #### getContentType

          public String getContentType()

    - #### setAlwaysEncoded

          public void setAlwaysEncoded(boolean ae)

    - #### isAlwaysEncoded

          public boolean isAlwaysEncoded()

    - #### setName

          public void setName(String newName)

      Sets the Name attribute of the Argument object.
      Specified by:
        `setName` in interface `TestElement`
      Overrides:
        `setName` in class `Argument`
      Parameters:
        `newName` - the new Name value

    - #### getEncodedValue

          public String getEncodedValue()

      Get the argument value encoded using UTF-8
      Returns:
        the argument value encoded in UTF-8

    - #### getEncodedValue

          public String getEncodedValue(String contentEncoding)
                                 throws UnsupportedEncodingException

      Get the argument value encoded in the specified encoding
      Parameters:
        `contentEncoding` - the encoding to use when encoding the argument value
      Returns:
        the argument value encoded in the specified encoding
      Throws:
        `UnsupportedEncodingException` - of the encoding is not supported

    - #### getEncodedName

          public String getEncodedName()

    - #### convertArgumentsToHTTP

          public static void convertArgumentsToHTTP(Arguments args)

      Converts all `Argument` entries in the collection to `HTTPArgument` entries.
      Parameters:
        `args` - collection of `Argument` and/or `HTTPArgument` entries

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