Apache JMeter

## org.apache.jmeter.protocol.http.control
Class HeaderManager

    java.lang.Object
      org.apache.jmeter.testelement.AbstractTestElement
          org.apache.jmeter.config.ConfigTestElement
              org.apache.jmeter.protocol.http.control.HeaderManager

All Implemented Interfaces:
  Serializable, Cloneable, ConfigElement, TestElement

    public class HeaderManager

extends ConfigTestElement
implements Serializable

This class provides an interface to headers file to pass HTTP headers along with a request.

Version:
  $Revision: 915405 $
See Also:
  Serialized Form

Field Summary
`static String` `HEADERS`

Fields inherited from class org.apache.jmeter.config.ConfigTestElement
`PASSWORD, USERNAME`

Fields inherited from interface org.apache.jmeter.testelement.TestElement
`COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

Constructor Summary
`HeaderManager()`

Method Summary
`void` `add()` Add an empty header.
`void` `add(Header h)` Add a header.
`void` `addFile(String headerFile)` Add header data from a file.
`void` `clear()` Clear the TestElement of all data.
`Header` `get(int i)` Return the header at index i.
`Class<? extends String>` `getColumnClass(int column)`
`int` `getColumnCount()`
`String` `getColumnName(int column)`
`Header` `getHeader(int row)`
`CollectionProperty` `getHeaders()` Get the collection of JMeterProperty entries representing the headers.
`Object` `getSOAPHeader()` Added support for SOAP related header stuff. 1-29-04 Peter Lin
`HeaderManager` `merge(TestElement element, boolean preferLocalValues)` Merge the attributes with a another HeaderManager's attributes.
`void` `remove(int index)` Remove a header.
`void` `removeHeaderNamed(String name)`
`void` `save(String headFile)` Save the header data to a file.
`void` `setSOAPHeader(Object header)` Set the SOAPHeader with the SOAPHTTPConnection object.
`int` `size()` Return the number of headers.

Methods inherited from class org.apache.jmeter.config.ConfigTestElement
`addConfigElement, addTestElement, expectsModification`

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

`addProperty, canRemove, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, 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.config.ConfigElement
`clone`

Field Detail

### HEADERS

    public static final String HEADERS

See Also:
  Constant Field Values

Constructor Detail

### HeaderManager

    public HeaderManager()

Method Detail

### clear

    public void clear()

  Clear the TestElement of all data.

  Specified by:
    `clear` in interface `TestElement`
  Overrides:
    `clear` in class `AbstractTestElement`

### getHeaders

    public CollectionProperty getHeaders()

  Get the collection of JMeterProperty entries representing the headers.

  Returns:
    the header collection property

### getColumnCount

    public int getColumnCount()

### getColumnName

    public String getColumnName(int column)

### getColumnClass

    public Class<? extends String> getColumnClass(int column)

### getHeader

    public Header getHeader(int row)

### save

    public void save(String headFile)
              throws IOException

  Save the header data to a file.

  Throws:
    `IOException`

### addFile

    public void addFile(String headerFile)
                 throws IOException

  Add header data from a file.

  Throws:
    `IOException`

### add

    public void add(Header h)

  Add a header.

### add

    public void add()

  Add an empty header.

### remove

    public void remove(int index)

  Remove a header.

### size

    public int size()

  Return the number of headers.

### get

    public Header get(int i)

  Return the header at index i.

### removeHeaderNamed

    public void removeHeaderNamed(String name)

### getSOAPHeader

    public Object getSOAPHeader()

  Added support for SOAP related header stuff. 1-29-04 Peter Lin

  Returns:
    the SOAP header Object

### setSOAPHeader

    public void setSOAPHeader(Object header)

  Set the SOAPHeader with the SOAPHTTPConnection object. We may or may not want to rename this to setHeaderObject(Object). Concievably, other samplers may need this kind of functionality. 1-29-04 Peter Lin

  Parameters:
    `header` -

### merge

    public HeaderManager merge(TestElement element,
                               boolean preferLocalValues)

  Merge the attributes with a another HeaderManager's attributes.

  Parameters:
    `element` - The object to be merged with
    `preferLocalValues` - When both objects have a value for the same attribute, this flag determines which value is preferresd.

Apache JMeter

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