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
,Replaceable
,Searchable
,org.apache.jmeter.testelement.TestElement
This class provides an interface to headers file to pass HTTP headers along
with a request.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement
org.apache.jmeter.testelement.TestElement.Companion
-
Field Summary
Fields inherited from class org.apache.jmeter.config.ConfigTestElement
PASSWORD, USERNAME
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add()
Add an empty header.void
Add a header.void
Add header data from a file.void
clear()
get
(int i) Return the header at index i.getColumnClass
(int column) int
getColumnName
(int column) getFirstHeaderNamed
(String name) Get the first header from Headers by the header name, ornull
if not found.getHeader
(int row) Get the collection of JMeterProperty entries representing the headers.org.apache.jmeter.testelement.schema.PropertiesAccessor<? extends HeaderManager,
? extends org.apache.jmeter.protocol.http.control.HeaderManagerSchema> getProps()
org.apache.jmeter.protocol.http.control.HeaderManagerSchema
merge
(org.apache.jmeter.testelement.TestElement element) Merge the attributes with a another HeaderManager's attributes.merge
(org.apache.jmeter.testelement.TestElement element, boolean preferLocalValues) Deprecated.void
void
remove
(int index) Remove a header.void
removeHeaderNamed
(String name) Remove from Headers the header named nameint
Replace in object by replaceByvoid
Save the header data to a file.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
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, 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.config.ConfigElement
clone
Methods inherited from interface org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set
-
Field Details
-
HEADERS
- See Also:
-
-
Constructor Details
-
HeaderManager
public HeaderManager()
-
-
Method Details
-
getSchema
public org.apache.jmeter.protocol.http.control.HeaderManagerSchema getSchema()- Specified by:
getSchema
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
getSchema
in classConfigTestElement
-
getProps
public org.apache.jmeter.testelement.schema.PropertiesAccessor<? extends HeaderManager,? extends org.apache.jmeter.protocol.http.control.HeaderManagerSchema> getProps()- Specified by:
getProps
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
getProps
in classConfigTestElement
-
recoverRunningVersion
public void recoverRunningVersion()Description copied from class:AbstractTestElement
- Specified by:
recoverRunningVersion
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
recoverRunningVersion
in classAbstractTestElement
-
clear
public void clear()- Specified by:
clear
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
clear
in classAbstractTestElement
-
getHeaders
Get the collection of JMeterProperty entries representing the headers.- Returns:
- the header collection property
-
getColumnCount
public int getColumnCount() -
getColumnName
-
getColumnClass
-
getHeader
-
save
Save the header data to a file.- Parameters:
headFile
- name of the file to store headers into. If name is relative the system propertyuser.dir
will be prepended- Throws:
IOException
- if writing the headers fails
-
addFile
Add header data from a file.- Parameters:
headerFile
- name of the file to read headers from. If name is relative the system propertyuser.dir
will be prepended- Throws:
IOException
- if reading headers fails
-
add
Add a header.- Parameters:
h
-Header
to add
-
add
public void add()Add an empty header. -
remove
public void remove(int index) Remove a header.- Parameters:
index
- index from the header to remove
-
size
public int size()Return the number of headers.- Returns:
- number of headers
-
get
Return the header at index i.- Parameters:
i
- index of the header to get- Returns:
Header
at indexi
-
getFirstHeaderNamed
Get the first header from Headers by the header name, ornull
if not found.- Parameters:
name
- header name- Returns:
- the first header from Headers by the header name, or
null
if not found
-
removeHeaderNamed
Remove from Headers the header named name- Parameters:
name
- header name
-
merge
@Deprecated public HeaderManager merge(org.apache.jmeter.testelement.TestElement element, boolean preferLocalValues) Deprecated.since 3.2, usemerge(TestElement)
as this method will be removed in a future versionMerge the attributes with a another HeaderManager's attributes.- Parameters:
element
- The object to be merged withpreferLocalValues
- Not used- Returns:
- merged HeaderManager
- Throws:
IllegalArgumentException
- ifelement
is not an instance ofHeaderManager
-
merge
Merge the attributes with a another HeaderManager's attributes.- Parameters:
element
- The object to be merged with- Returns:
- merged HeaderManager
- Throws:
IllegalArgumentException
- ifelement
is not an instance ofHeaderManager
-
replace
Description copied from interface:Replaceable
Replace in object by replaceBy- Specified by:
replace
in interfaceReplaceable
- Parameters:
regex
- Regular expression to search forreplaceBy
- Text used as replacementcaseSensitive
- flag, whether search should be done case sensitive- Returns:
- number of replacements
- Throws:
Exception
- when something fails while replacing
-
merge(TestElement)
as this method will be removed in a future version