org.apache.jmeter.protocol.http.util

## Class HTTPFileArg

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.protocol.http.util.HTTPFileArg

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

      public class HTTPFileArg
      extends AbstractTestElement
      implements java.io.Serializable

  Class representing a file parameter for http upload. Consists of a http parameter name/file path pair with (optional) mimetype. Also provides temporary storage for the headers which are sent with files.
  See Also:
    Serialized Form

- - ### Field Summary

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

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTTPFileArg()` Constructor for an empty HTTPFileArg object
    `HTTPFileArg(HTTPFileArg file)` Copy Constructor.
    `HTTPFileArg(JMeterProperty path, JMeterProperty paramname, JMeterProperty mimetype)` Constructor for the HTTPFileArg object with full information, using existing properties
    `HTTPFileArg(java.lang.String path)` Constructor for the HTTPFileArg object with given path.
    `HTTPFileArg(java.lang.String path, java.lang.String paramname, java.lang.String mimetype)` Constructor for the HTTPFileArg object with full information.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getHeader()` Gets the saved body header for the HTTPFileArg object.
    `java.lang.String` | `getMimeType()` Get the mimetype of the File.
    `java.lang.String` | `getParamName()` Get the http parameter name of the File.
    `java.lang.String` | `getPath()` Get the path of the File.
    `boolean` | `isNotEmpty()` Check if the entry is not empty.
    `void` | `setHeader(java.lang.String newHeader)` Sets the body header for the HTTPFileArg object.
    `void` | `setMimeType(java.lang.String newMimeType)` Set the mimetype of the File.
    `void` | `setParamName(java.lang.String newParamName)` Set the http parameter name of the File.
    `void` | `setPath(java.lang.String newPath)` Set the path of the File.
    `java.lang.String` | `toString()` returns path, param name, mime type information of HTTPFileArg object.

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

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, 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, wait, wait, wait`

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

      `removed`

- - ### Constructor Detail

    - #### HTTPFileArg

          public HTTPFileArg()

      Constructor for an empty HTTPFileArg object

    - #### HTTPFileArg

          public HTTPFileArg(java.lang.String path)

      Constructor for the HTTPFileArg object with given path.
      Parameters:
        `path` - path to the file to use
      Throws:
        `java.lang.IllegalArgumentException` - if `path` is `null`

    - #### HTTPFileArg

          public HTTPFileArg(java.lang.String path,
                             java.lang.String paramname,
                             java.lang.String mimetype)

      Constructor for the HTTPFileArg object with full information.
      Parameters:
        `path` - path of the file to use
        `paramname` - name of the http parameter to use for the file
        `mimetype` - mimetype of the file
      Throws:
        `java.lang.IllegalArgumentException` - if any parameter is `null`

    - #### HTTPFileArg

          public HTTPFileArg(JMeterProperty path,
                             JMeterProperty paramname,
                             JMeterProperty mimetype)

      Constructor for the HTTPFileArg object with full information, using existing properties
      Parameters:
        `path` - path of the file to use
        `paramname` - name of the http parameter to use for the file
        `mimetype` - mimetype of the file
      Throws:
        `java.lang.IllegalArgumentException` - if any parameter is `null`

    - #### HTTPFileArg

          public HTTPFileArg(HTTPFileArg file)

      Copy Constructor.
      Parameters:
        `file` - `HTTPFileArg` to get information about the path, http parameter name and mimetype of the file
      Throws:
        `java.lang.IllegalArgumentException` - if any of those retrieved information is `null`

  - ### Method Detail

    - #### setParamName

          public void setParamName(java.lang.String newParamName)

      Set the http parameter name of the File.
      Parameters:
        `newParamName` - the new http parameter name

    - #### getParamName

          public java.lang.String getParamName()

      Get the http parameter name of the File.
      Returns:
        the http parameter name

    - #### setMimeType

          public void setMimeType(java.lang.String newMimeType)

      Set the mimetype of the File.
      Parameters:
        `newMimeType` - the new mimetype

    - #### getMimeType

          public java.lang.String getMimeType()

      Get the mimetype of the File.
      Returns:
        the http parameter mimetype

    - #### setPath

          public void setPath(java.lang.String newPath)

      Set the path of the File.
      Parameters:
        `newPath` - the new path

    - #### getPath

          public java.lang.String getPath()

      Get the path of the File.
      Returns:
        the file's path

    - #### setHeader

          public void setHeader(java.lang.String newHeader)

      Sets the body header for the HTTPFileArg object. Header contains path, parameter name and mime type information. This is only intended for use by methods which need to store information temporarily whilst creating the HTTP body.
      Parameters:
        `newHeader` - the new Header value

    - #### getHeader

          public java.lang.String getHeader()

      Gets the saved body header for the HTTPFileArg object.
      Returns:
        saved body header

    - #### toString

          public java.lang.String toString()

      returns path, param name, mime type information of HTTPFileArg object.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string demonstration of HTTPFileArg object in this format: "path:'<PATH>'|param:'<PARAM NAME>'|mimetype:'<MIME TYPE>'"

    - #### isNotEmpty

          public boolean isNotEmpty()

      Check if the entry is not empty.
      Returns:
        true if Path, name or mimetype fields are not the empty string

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