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.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
MULTIPART_FORM_CONTENT_TYPE
已过时。
The Content-Type for multipart/form-data.
|
| 构造器和说明 |
|---|
MultipartPostMethod()
已过时。
No-arg constructor.
|
MultipartPostMethod(String uri)
已过时。
Constructor specifying a URI.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addContentLengthRequestHeader(HttpState state,
HttpConnection conn)
已过时。
Adds a Content-Length request header, as long as no
Content-Length request header already exists.
|
protected void |
addContentTypeRequestHeader(HttpState state,
HttpConnection conn)
已过时。
Adds a Content-Type request header.
|
void |
addParameter(String parameterName,
File parameterFile)
已过时。
Adds a binary file part
|
void |
addParameter(String parameterName,
String parameterValue)
已过时。
Adds a text field part
|
void |
addParameter(String parameterName,
String fileName,
File parameterFile)
已过时。
Adds a binary file part with the given file name
|
void |
addPart(Part part)
已过时。
Adds a part.
|
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
已过时。
Populates the request headers map to with additional
headers to be submitted to
the given HttpConnection. |
String |
getName()
已过时。
Returns "POST".
|
Part[] |
getParts()
已过时。
Returns all parts.
|
protected long |
getRequestContentLength()
已过时。
Return the length of the request body.
|
protected boolean |
hasRequestContent()
已过时。
Returns true
|
void |
recycle()
已过时。
no longer supported and will be removed in the future
version of HttpClient
|
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
已过时。
Writes the request body to the given
connection. |
getUseExpectHeader, setUseExpectHeaderabort, 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, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isHttp11, isRequestSent, isStrictMode, 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, writeRequestLinepublic MultipartPostMethod()
public MultipartPostMethod(String uri)
uri - either an absolute or relative URIprotected boolean hasRequestContent()
hasRequestContent 在类中 ExpectContinueMethodpublic String getName()
getName 在接口中 HttpMethodgetName 在类中 HttpMethodBasepublic 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 在类中 ExpectContinueMethodstate - 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(com.ptteng.course.util.aliPayUtil.apacheCommonUtil.httpclient.HttpState, com.ptteng.course.util.aliPayUtil.apacheCommonUtil.httpclient.HttpConnection)protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException
connection.writeRequestBody 在类中 HttpMethodBasestate - 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.
IOExceptionpublic void recycle()
recycle 在接口中 HttpMethodrecycle 在类中 HttpMethodBaseHttpMethodBase.releaseConnection()Copyright © 2017. All rights reserved.