MultipartRequestEntity
in conjunction with PostMethod
instead.public class MultipartPostMethod extends ExpectContinueMethod
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.
Modifier and Type | Field and Description |
---|---|
static String |
MULTIPART_FORM_CONTENT_TYPE
Deprecated.
The Content-Type for multipart/form-data.
|
effectiveVersion, statusLine
Constructor and Description |
---|
MultipartPostMethod()
Deprecated.
No-arg constructor.
|
MultipartPostMethod(String uri)
Deprecated.
Constructor specifying a URI.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addContentLengthRequestHeader(HttpState state,
HttpConnection conn)
Deprecated.
Adds a Content-Length request header, as long as no
Content-Length request header already exists.
|
protected void |
addContentTypeRequestHeader(HttpState state,
HttpConnection conn)
Deprecated.
Adds a Content-Type request header.
|
void |
addParameter(String parameterName,
File parameterFile)
Deprecated.
Adds a binary file part
|
void |
addParameter(String parameterName,
String parameterValue)
Deprecated.
Adds a text field part
|
void |
addParameter(String parameterName,
String fileName,
File parameterFile)
Deprecated.
Adds a binary file part with the given file name
|
void |
addPart(Part part)
Deprecated.
Adds a part.
|
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
Deprecated.
Populates the request headers map to with additional
headers to be submitted to
the given HttpConnection . |
String |
getName()
Deprecated.
Returns "POST".
|
Part[] |
getParts()
Deprecated.
Returns all parts.
|
protected long |
getRequestContentLength()
Deprecated.
Return the length of the request body.
|
protected boolean |
hasRequestContent()
Deprecated.
Returns true
|
void |
recycle()
Deprecated.
no longer supported and will be removed in the future
version of HttpClient
|
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
Deprecated.
Writes the request body to the given
connection . |
getUseExpectHeader, setUseExpectHeader
abort, addCookieRequestHeader, addHostRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getEffectiveVersion, getFollowRedirects, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getParams, getPath, getProxyAuthenticationRealm, getProxyAuthState, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isHttp11, isRequestSent, isStrictMode, processCookieHeaders, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseBody, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setMethodRetryHandler, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, setURI, shouldCloseConnection, validate, writeRequest, writeRequestHeaders, writeRequestLine
public static final String MULTIPART_FORM_CONTENT_TYPE
public MultipartPostMethod()
public MultipartPostMethod(String uri)
uri
- either an absolute or relative URIprotected boolean hasRequestContent()
hasRequestContent
in class ExpectContinueMethod
public String getName()
getName
in interface HttpMethod
getName
in class HttpMethodBase
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 fileFileNotFoundException
- If the file cannot be found.public void addPart(Part part)
part
- The part to add.public Part[] getParts()
protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException
state
- current state of http requestsconn
- the connection to use for I/OIOException
- 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.protected void addContentTypeRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException
state
- current state of http requestsconn
- the connection to use for I/OIOException
- 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.protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException
headers
to be submitted to
the given HttpConnection
.
This implementation adds tt>Content-Length and Content-Type 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 ExpectContinueMethod
state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP methodIOException
- 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.HttpMethodBase.writeRequestHeaders(edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.HttpState, edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.HttpConnection)
protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException
connection
.writeRequestBody
in class HttpMethodBase
state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP methodIOException
- 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.protected long getRequestContentLength() throws IOException
Return the length of the request body.
Once this method has been invoked, the request parameters cannot be
altered until the method is recycled
.
IOException
public void recycle()
recycle
in interface HttpMethod
recycle
in class HttpMethodBase
HttpMethodBase.releaseConnection()
Copyright © 2016 Internet2. All rights reserved.