com.pushtotest.tool.protocolhandler
Class HTTPHeader
java.lang.Object
com.pushtotest.tool.protocolhandler.HeaderWrapper
com.pushtotest.tool.protocolhandler.HTTPHeader
- All Implemented Interfaces:
- Header
public class HTTPHeader
- extends HeaderWrapper
This is an interface that should be implemented to allow Protocol specific
setting of the headers of a request.
|
Method Summary |
void |
addHeaders(java.net.HttpURLConnection con)
Allows the Body object to add its own HTTP header parameters, this is only really
useful for multipart forms. |
java.lang.String |
id()
Returns an id for this protocol. |
void |
setCookies(java.util.Hashtable ht)
Sets the value of multiple cookies |
java.lang.String |
toString()
Returns the content of the header to be used by the Protocol. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
HTTPHeader
public HTTPHeader()
id
public java.lang.String id()
- Returns an id for this protocol. The id is a string
that will be used to uniquily identify the protocol.
For example :// would be appropriate (without the "://").
- Specified by:
id in interface Header- Specified by:
id in class HeaderWrapper
- Returns:
- The id for this Protocol.
toString
public java.lang.String toString()
- Returns the content of the header to be used by the Protocol.
- Specified by:
toString in interface Header- Specified by:
toString in class HeaderWrapper
- Returns:
- All of the content that should be sent as the Protocol header.
addHeaders
public void addHeaders(java.net.HttpURLConnection con)
- Allows the Body object to add its own HTTP header parameters, this is only really
useful for multipart forms.
- Parameters:
con - The HttpURLConnection object that will communicate with the host using HTTP protocols
setCookies
public void setCookies(java.util.Hashtable ht)
- Sets the value of multiple cookies
- Parameters:
Hashtable - Contains multiple name/value pairs one for each cookie.
Typically the cookie Hashtable is instantiated and initialized by
the HTTPResponse.getCookies() method. In TestMaker/Jython script
one would use the following to create the cookie Hashtable:
from java import util as jutil
cookies = jutil.Hashtable()
cookies['userid'] = "018382"
cookies['sessionid'] = "3882828v39292"
http_header_object.setCookies( cookies )