|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.httpclient.HttpMethodBase | +--org.apache.commons.httpclient.methods.GetMethod | +--org.apache.commons.httpclient.methods.MultipartPostMethod
POST Method for Multipart encoded forms.
Field Summary |
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase |
USER_AGENT |
Constructor Summary | |
MultipartPostMethod()
No-arg constructor. |
|
MultipartPostMethod(java.lang.String uri)
Constructor specifying a URI. |
|
MultipartPostMethod(java.lang.String uri,
java.lang.String tempDir)
Constructor specifying a URI and tempDir. |
|
MultipartPostMethod(java.lang.String uri,
java.lang.String tempDir,
java.lang.String tempFile)
Constructor specifying a URI, tempDir and tempFile. |
Method Summary | |
void |
addParameter(java.lang.String parameterName,
java.io.File parameterFile)
|
void |
addParameter(java.lang.String parameterName,
java.lang.String parameterValue)
|
void |
addParameter(java.lang.String parameterName,
java.lang.String fileName,
java.io.File parameterFile)
|
void |
addPart(Part part)
Adds another part to this post. |
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
Populates the request headers map to with additional headers to be submitted to the given HttpConnection . |
java.lang.String |
getName()
Returns "POST". |
protected int |
getRequestContentLength()
Override method of HttpMethodBase
to return the length of the request body. |
void |
recycle()
Clear my request body. |
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
Override method of HttpMethodBase
to write request parameters as the
request body. |
Methods inherited from class org.apache.commons.httpclient.methods.GetMethod |
getFileData, getResponseBody, getResponseBodyAsStream, 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 |
Constructor Detail |
public MultipartPostMethod()
public MultipartPostMethod(java.lang.String uri)
uri
- either an absolute or relative URIpublic MultipartPostMethod(java.lang.String uri, java.lang.String tempDir)
uri
- either an absolute or relative URItempDir
- directory to store temp files inpublic MultipartPostMethod(java.lang.String uri, java.lang.String tempDir, java.lang.String tempFile)
uri
- either an absolute or relative URItempDir
- directory to store temp files intempFile
- file to store temporary data inMethod Detail |
public java.lang.String getName()
getName
in interface HttpMethod
getName
in class GetMethod
public void recycle()
recycle
in interface HttpMethod
recycle
in class GetMethod
public void addParameter(java.lang.String parameterName, java.lang.String parameterValue)
public void addParameter(java.lang.String parameterName, java.io.File parameterFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void addParameter(java.lang.String parameterName, java.lang.String fileName, java.io.File parameterFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void addPart(Part part)
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
HttpMethodBase
headers
to be submitted to the given HttpConnection
.
This implementation adds User-Agent, Host, Cookie, Content-Length, Transfer-Encoding, and Authorization headers, when appropriate.
Subclasses may want to override this method to to add additional headers, and may choose to invoke this implementation (via super) to add the "standard" headers.
addRequestHeaders
in class HttpMethodBase
state
- the client stateconn
- the HttpConnection
the headers will eventually be
written to
HttpException
- when a HTTP protocol error occurs
java.io.IOException
- when an error occurs writing the requestHttpMethodBase.writeRequestHeaders(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)
protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
HttpMethodBase
to write request parameters as the
request body.
writeRequestBody
in class HttpMethodBase
state
- the client stateconn
- the connection to write to
HttpException
- when a protocol error occurs or state is invalid
java.io.IOException
- when i/o errors occur reading the responseprotected int getRequestContentLength()
HttpMethodBase
to 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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |