1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 package org.apache.commons.httpclient.methods;
32
33 import java.io.IOException;
34 import java.io.OutputStream;
35
36 /***
37 * @since 3.0
38 */
39 public interface RequestEntity {
40
41 /***
42 * Tests if {@link #writeRequest(OutputStream)} can be called more than once.
43 *
44 * @return <tt>true</tt> if the entity can be written to {@link OutputStream} more than once,
45 * <tt>false</tt> otherwise.
46 */
47 boolean isRepeatable();
48
49 /***
50 * Writes the request entity to the given stream.
51 * @param out
52 * @throws IOException
53 */
54 void writeRequest(OutputStream out) throws IOException;
55
56 /***
57 * Gets the request entity's length. This method should return a non-negative value if the content
58 * length is known or a negative value if it is not. In the latter case the
59 * {@link org.apache.commons.httpclient.methods.EntityEnclosingMethod} will use chunk encoding to
60 * transmit the request entity.
61 *
62 * @return a non-negative value when content length is known or a negative value when content length
63 * is not known
64 */
65 long getContentLength();
66
67 /***
68 * Gets the entity's content type. This content type will be used as the value for the
69 * "Content-Type" header.
70 * @return the entity's content type
71 * @see org.apache.commons.httpclient.HttpMethod#setRequestHeader(String, String)
72 */
73 String getContentType();
74
75 }