|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pushtotest.tool.protocolhandler.HTTPMultipartBody
public class HTTPMultipartBody
This is an implementation of the Body interface for the HTTP and related protocols. This enables multipart MIME encoded forms.
| Constructor Summary | |
|---|---|
HTTPMultipartBody()
|
|
| Method Summary | |
|---|---|
void |
addFile(java.lang.String filename,
java.lang.String contenttype,
java.lang.String parametername)
Adds a file that will be MIME encoded. |
void |
addHeaders(java.net.HttpURLConnection con)
Allows the Body object to add its own HTTP header parameters |
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.lang.String |
id()
Returns an id for this protocol. |
void |
setData(java.lang.String bodydata)
|
void |
setFile(java.lang.String filename,
java.lang.String contenttype)
Identifies a file that will be MIME encoded. |
void |
setFile(java.lang.String filename,
java.lang.String contenttype,
java.lang.String parametername)
Identifies a file that will be MIME encoded. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HTTPMultipartBody()
| Method Detail |
|---|
public java.lang.String id()
id in interface Body
public java.lang.String getBody()
throws ToolException
getBody in interface BodyToolException
public void setFile(java.lang.String filename,
java.lang.String contenttype,
java.lang.String parametername)
filename - The name and path to the file that will be encoded and sent to the hostcontenttype - The MIME content type of the file, for example, plain/text or audio/x-pn-realaudioparametername - The value of the name field in the content type description
public void setFile(java.lang.String filename,
java.lang.String contenttype)
filename - The name and path to the file that will be encoded and sent to the hostcontenttype - The MIME content type of the file, for example, plain/text or audio/x-pn-realaudio
public void addFile(java.lang.String filename,
java.lang.String contenttype,
java.lang.String parametername)
filename - The name and path to the file that will be encoded and sent to the hostcontenttype - The MIME content type of the file, for example, plain/text or audio/x-pn-realaudioparametername - The value of the name field in the content type descriptionpublic void setData(java.lang.String bodydata)
public void addHeaders(java.net.HttpURLConnection con)
addHeaders in interface Bodycon - The HttpURLConnection object that will communicate with the host using HTTP protocols
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||