|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pushtotest.tool.protocolhandler.HTTPBody
public class HTTPBody
This is an implementation of the Body interface for the HTTP and related protocols.
| Constructor Summary | |
|---|---|
HTTPBody()
|
|
| Method Summary | |
|---|---|
void |
addHeaders(java.net.HttpURLConnection con)
Adds the content-type header, assuming this is a POST |
void |
addParameter(java.lang.String name,
java.lang.String value)
Sets a parameter value pair as something that should be set in the header of this protocol. |
void |
addParameter(java.lang.String name,
java.lang.String value,
boolean encode)
Sets a parameter value pair as something that should be set in the header of this protocol. |
void |
addParameter(java.lang.String name,
java.lang.String value,
java.lang.String encoding)
Sets a parameter value pair as something that should be set in the header of this protocol. |
java.lang.String |
get(java.lang.String name)
Returns the value of a first parameter variable as a String. |
java.lang.String |
getBody()
Returns the content of the body to be used by the Protocol. |
java.lang.String |
getNext()
Returns additional header values with the same key defined using the get() method. |
java.util.Iterator |
getParams()
Returns an Iterator of all of the parameter keys so that they user can get the list and then get the values. |
java.lang.String |
id()
Returns an id for this protocol. |
protected java.lang.String |
paramsAsString()
Gets all of the keys and values and turns them into the proper kind of string to be sent as a POST or a GET. |
java.lang.Object |
removeParameter(java.lang.String name)
Removes a key/value from the parameters |
void |
setContentType(java.lang.String newtype)
Sets the value to be used in the Content-Type header of a POST to the target host |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTTPBody()
| Method Detail |
|---|
public java.lang.String id()
id in interface Bodypublic java.lang.String getBody()
getBody in interface Body
public void addParameter(java.lang.String name,
java.lang.String value)
throws ToolException
set(name,value,encode) method passing through the
values and setting encode to 'false'.
addParameter in interface Bodyname - The name of the header variable.value - The value to set for this header variable.
ToolException
public void addParameter(java.lang.String name,
java.lang.String value,
boolean encode)
throws ToolException
name - The name of the header variable.value - The value to set for this header variable.encode - Whether or not to encode the value with the UTF-8 encoder
ToolException
public void addParameter(java.lang.String name,
java.lang.String value,
java.lang.String encoding)
throws ToolException
name - The name of the header variable.value - The value to set for this header variable.encode - Whether or not to encode the value with the right encoder
for this type.
ToolExceptionpublic java.lang.String get(java.lang.String name)
name - The name of the header variable to look for.public java.lang.String getNext()
public java.util.Iterator getParams()
protected java.lang.String paramsAsString()
public java.lang.Object removeParameter(java.lang.String name)
String - key to parameter valuepublic void addHeaders(java.net.HttpURLConnection con)
addHeaders in interface Bodycon - The HttpURLConnection object that will communicate with the host using HTTP protocolspublic void setContentType(java.lang.String newtype)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||