|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.httpclient.HttpMethodBase
org.apache.commons.httpclient.methods.GetMethod
org.apache.commons.httpclient.methods.ExpectContinueMethod
org.apache.commons.httpclient.methods.MultipartPostMethod
POST Method for Multipart encoded forms.
Field Summary | |
static String |
MULTIPART_FORM_CONTENT_TYPE
The Content-Type for multipart/form-data. |
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase |
USER_AGENT |
Constructor Summary | |
MultipartPostMethod()
No-arg constructor. |
|
MultipartPostMethod(String uri)
Constructor specifying a URI. |
|
MultipartPostMethod(String uri,
String tempDir)
Constructor specifying a URI and tempDir. |
|
MultipartPostMethod(String uri,
String tempDir,
String tempFile)
Constructor specifying a URI, tempDir and tempFile. |
Method Summary | |
void |
addParameter(String parameterName,
File parameterFile)
Add a parameter |
void |
addParameter(String parameterName,
String parameterValue)
Add a parameter |
void |
addParameter(String parameterName,
String fileName,
File parameterFile)
Add a parameter. |
void |
addPart(Part part)
Adds another part to this post. |
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
Add content type header and set the Expect header if it has not already been set, in addition to the "standard" set of headers |
String |
getName()
Returns "POST". |
Part[] |
getParts()
Return all parts. |
protected int |
getRequestContentLength()
Return the length of the request body. |
protected boolean |
hasRequestContent()
Returns true |
void |
recycle()
Clear my request body. |
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
Write the request body. |
Methods inherited from class org.apache.commons.httpclient.methods.ExpectContinueMethod |
getUseExpectHeader, setUseExpectHeader |
Methods inherited from class org.apache.commons.httpclient.methods.GetMethod |
getFileData, getTempDir, getTempFile, getUseDisk, readResponseBody, setFileData, setTempDir, setTempFile, setUseDisk |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String MULTIPART_FORM_CONTENT_TYPE
Constructor Detail |
public MultipartPostMethod()
public MultipartPostMethod(String uri)
uri
- either an absolute or relative URIpublic MultipartPostMethod(String uri, String tempDir)
uri
- either an absolute or relative URItempDir
- directory to store temp files inpublic MultipartPostMethod(String uri, String tempDir, String tempFile)
uri
- either an absolute or relative URItempDir
- directory to store temp files intempFile
- file to store temporary data inMethod Detail |
protected boolean hasRequestContent()
hasRequestContent
in class ExpectContinueMethod
public String getName()
getName
in interface HttpMethod
getName
in class GetMethod
public void addParameter(String parameterName, String parameterValue)
parameterName
- The name of the parameter.parameterValue
- The value of the parameter.public void addParameter(String parameterName, File parameterFile) throws FileNotFoundException
parameterName
- The name of the parameterparameterFile
- The name of the file.
FileNotFoundException
- If the file cannot be found.public void addParameter(String parameterName, String fileName, File parameterFile) throws FileNotFoundException
parameterName
- The name of the parameterfileName
- The file nameparameterFile
- The file
FileNotFoundException
- If the file cannot be found.public void addPart(Part part)
part
- The part to add.public Part[] getParts()
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException
addRequestHeaders
in class ExpectContinueMethod
state
- the client stateconn
- the HttpConnection
the headers will eventually be
written to
IOException
- when an error occurs writing the request
HttpException
- when a HTTP protocol error occursprotected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException
writeRequestBody
in class HttpMethodBase
state
- the client stateconn
- the connection to write to
IOException
- when i/o errors occur reading the response
HttpException
- when a protocol error occurs or state is invalidprotected int getRequestContentLength()
Return the length of the request body.
Once this method has been invoked, the request parameters cannot be
altered until I am recycled
.
getRequestContentLength
in class HttpMethodBase
public void recycle()
recycle
in interface HttpMethod
recycle
in class GetMethod
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |