|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectorg.apache.http.entity.AbstractHttpEntity
im.yixin.sdk.http.multipart.MultipartEntity
public class MultipartEntity
Implements a request entity suitable for an 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.
This entity is designed to be used in conjunction with the
HttpRequest
to provide multipart posts. Example
usage:
File f = new File("/path/fileToUpload.txt"); HttpRequest request = new HttpRequest("http://host/some_path"); Part[] parts = { new StringPart("param_name", "value"), new FilePart(f.getName(), f) }; filePost.setEntity(new MultipartRequestEntity(parts, filePost.getParams())); HttpClient client = new HttpClient(); int status = client.executeMethod(filePost);
字段摘要 | |
---|---|
static java.lang.String |
MULTIPART_BOUNDARY
Sets the value to use as the multipart boundary. |
protected Part[] |
parts
The MIME parts as set by the constructor |
从类 org.apache.http.entity.AbstractHttpEntity 继承的字段 |
---|
chunked, contentEncoding, contentType |
构造方法摘要 | |
---|---|
MultipartEntity(Part[] parts)
|
|
MultipartEntity(Part[] parts,
org.apache.http.params.HttpParams params)
Creates a new multipart entity containing the given parts. |
方法摘要 | |
---|---|
static byte[] |
generateMultipartBoundary()
Generates a random multipart boundary string. |
java.io.InputStream |
getContent()
|
long |
getContentLength()
|
org.apache.http.Header |
getContentType()
|
protected byte[] |
getMultipartBoundary()
Returns the MIME boundary string that is used to demarcate boundaries of this part. |
boolean |
isRepeatable()
Returns true if all parts are repeatable, false
otherwise. |
boolean |
isStreaming()
|
void |
writeTo(java.io.OutputStream out)
|
从类 org.apache.http.entity.AbstractHttpEntity 继承的方法 |
---|
consumeContent, getContentEncoding, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
public static final java.lang.String MULTIPART_BOUNDARY
This parameter expects a value if type String
.
protected Part[] parts
构造方法详细信息 |
---|
public MultipartEntity(Part[] parts, org.apache.http.params.HttpParams params)
parts
- The parts to include.params
- The params of the HttpMethod using this entity.public MultipartEntity(Part[] parts)
方法详细信息 |
---|
public static byte[] generateMultipartBoundary()
protected byte[] getMultipartBoundary()
public boolean isRepeatable()
true
if all parts are repeatable, false
otherwise.
public void writeTo(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public org.apache.http.Header getContentType()
org.apache.http.HttpEntity
中的 getContentType
org.apache.http.entity.AbstractHttpEntity
中的 getContentType
public long getContentLength()
public java.io.InputStream getContent() throws java.io.IOException, java.lang.IllegalStateException
java.io.IOException
java.lang.IllegalStateException
public boolean isStreaming()
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |