org.apache.commons.httpclient.methods
Class MultipartPostMethod
Implements the HTTP multipart POST method.
The HTTP multipart POST method is defined in section 3.3 of
RFC1867 :
The media-type multipart/form-data follows the rules of all multipart
MIME data streams as outlined in RFC 1521. The multipart/form-data contains
a series of parts. Each part is expected to contain a content-disposition
header where the value is "form-data" and a name attribute specifies
the field name within the form, e.g., 'content-disposition: form-data;
name="xxxxx"', where xxxxx is the field name corresponding to that field.
Field names originally in non-ASCII character sets may be encoded using
the method outlined in RFC 1522.
Since 2.0
Version Not specified.
Author <a href="mailto:mattalbright@yahoo.com">Matthew Albright</a>, <a href="mailto:jsdever@apache.org">Jeff Dever</a>, <a href="mailto:adrian@ephox.com">Adrian Sutton</a>, <a href="mailto:mdiggory@latte.harvard.edu">Mark Diggory</a>, <a href="mailto:mbowler@Ga
abort ()
addCookieRequestHeader (HttpState, HttpConnection)
addHostRequestHeader (HttpState, HttpConnection)
addProxyConnectionHeader (HttpState, HttpConnection)
addRequestHeader (String, String)
addRequestHeader (Header)
addResponseFooter (Header)
addUserAgentRequestHeader (HttpState, HttpConnection)
checkNotUsed ()
checkUsed ()
execute (HttpState, HttpConnection)
generateRequestLine (HttpConnection, String, String, String, String)
getAuthenticationRealm ()
getContentCharSet (Header)
getDoAuthentication ()
getEffectiveVersion ()
getFollowRedirects ()
getHostAuthState ()
getHostConfiguration ()
getMethodRetryHandler ()
getParams ()
getPath ()
getProxyAuthenticationRealm ()
getProxyAuthState ()
getQueryString ()
getRecoverableExceptionCount ()
getRequestCharSet ()
getRequestHeader (String)
getRequestHeaderGroup ()
getRequestHeaders ()
getRequestHeaders (String)
getResponseBody ()
getResponseBodyAsStream ()
getResponseBodyAsString ()
getResponseCharSet ()
getResponseContentLength ()
getResponseFooter (String)
getResponseFooters ()
getResponseHeader (String)
getResponseHeaderGroup ()
getResponseHeaders (String)
getResponseHeaders ()
getResponseStream ()
getResponseTrailerHeaderGroup ()
getStatusCode ()
getStatusLine ()
getStatusText ()
getURI ()
hasBeenUsed ()
isAborted ()
isConnectionCloseForced ()
isHttp11 ()
isRequestSent ()
isStrictMode ()
processResponseBody (HttpState, HttpConnection)
processResponseHeaders (HttpState, HttpConnection)
processStatusLine (HttpState, HttpConnection)
readResponse (HttpState, HttpConnection)
readResponseBody (HttpState, HttpConnection)
readResponseHeaders (HttpState, HttpConnection)
readStatusLine (HttpState, HttpConnection)
releaseConnection ()
removeRequestHeader (String)
removeRequestHeader (Header)
responseBodyConsumed ()
setConnectionCloseForced (boolean)
setDoAuthentication (boolean)
setFollowRedirects (boolean)
setHostConfiguration (HostConfiguration)
setHttp11 (boolean)
setMethodRetryHandler (MethodRetryHandler)
setParams (HttpMethodParams)
setPath (String)
setQueryString (String)
setQueryString (NameValuePair[])
setRequestHeader (String, String)
setRequestHeader (Header)
setResponseStream (InputStream)
setStrictMode (boolean)
setURI (URI)
shouldCloseConnection (HttpConnection)
validate ()
writeRequest (HttpState, HttpConnection)
writeRequestHeaders (HttpState, HttpConnection)
writeRequestLine (HttpState, HttpConnection)
MULTIPART_FORM_CONTENT_TYPE
public static
String
MULTIPART_FORM_CONTENT_TYPE
MultipartPostMethod
public
MultipartPostMethod
(
)
MultipartPostMethod
public
MultipartPostMethod
(
String
uri
)
Parameters
Type Name Description
String
uri
either an absolute or relative URI
addContentLengthRequestHeader
Parameters
Type Name Description
HttpState
state
current state of http requests
HttpConnection
conn
the connection to use for I/O
Returns
void
Exceptions
IOException
if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
HttpException
if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
addContentTypeRequestHeader
Parameters
Type Name Description
HttpState
state
current state of http requests
HttpConnection
conn
the connection to use for I/O
Returns
void
Exceptions
IOException
if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
HttpException
if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
addParameter
public
void
addParameter
(
String
parameterName,
String
parameterValue
)
Parameters
Type Name Description
String
parameterName
The name of the parameter.
String
parameterValue
The value of the parameter.
Returns
void
addParameter
public
void
addParameter
(
String
parameterName,
File
parameterFile
)
Parameters
Type Name Description
String
parameterName
The name of the parameter
File
parameterFile
The name of the file.
Returns
void
addParameter
public
void
addParameter
(
String
parameterName,
String
fileName,
File
parameterFile
)
Parameters
Type Name Description
String
parameterName
The name of the parameter
String
fileName
The file name
File
parameterFile
The file
Returns
void
addPart
public
void
addPart
(
Part
part
)
Parameters
Type Name Description
Part
part
The part to add.
Returns
void
addRequestHeaders
Returns
void
Exceptions
IOException
if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
HttpException
if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
getParts
public
Part []
getParts
(
)
getRequestContentLength
protected
long
getRequestContentLength
(
)
hasRequestContent
protected
boolean
hasRequestContent
(
)
recycle
public
void
recycle
(
)
writeRequestBody
Exceptions
IOException
if an I/O (transport) error occurs. Some transport exceptions
can be recovered from.
HttpException
if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.