|
36 | 36 | /**
|
37 | 37 | * The Request class can be used to construct HTTP request:
|
38 | 38 | * <blockquote><pre>
|
39 |
| - * Request r = new RequestBuilder().setUrl("url") |
40 |
| - * .setRealm((new Realm.RealmBuilder()).setPrincipal(user) |
41 |
| - * .setPassword(admin) |
42 |
| - * .setRealmName("MyRealm") |
43 |
| - * .setScheme(Realm.AuthScheme.DIGEST).build()); |
| 39 | + * Request r = new RequestBuilder() |
| 40 | + * .setUrl("url") |
| 41 | + * .setRealm( |
| 42 | + * new Realm.Builder("principal", "password") |
| 43 | + * .setRealmName("MyRealm") |
| 44 | + * .setScheme(Realm.AuthScheme.BASIC) |
| 45 | + * ).build(); |
44 | 46 | * </pre></blockquote>
|
45 | 47 | */
|
46 | 48 | public interface Request {
|
47 | 49 |
|
48 | 50 | /**
|
49 |
| - * Return the request's method name (GET, POST, etc.) |
50 |
| - * |
51 |
| - * @return the request's method name (GET, POST, etc.) |
| 51 | + * @return the request's HTTP method (GET, POST, etc.) |
52 | 52 | */
|
53 | 53 | String getMethod();
|
54 | 54 |
|
| 55 | + /** |
| 56 | + * |
| 57 | + * @return the uri |
| 58 | + */ |
55 | 59 | Uri getUri();
|
56 | 60 |
|
| 61 | + /** |
| 62 | + * @return the url (the uri's String form) |
| 63 | + */ |
57 | 64 | String getUrl();
|
58 | 65 |
|
59 | 66 | /**
|
60 |
| - * Return the InetAddress to override |
61 |
| - * |
62 |
| - * @return the InetAddress |
| 67 | + * @return the InetAddress to be used to bypass uri's hostname resolution |
63 | 68 | */
|
64 | 69 | InetAddress getAddress();
|
65 | 70 |
|
| 71 | + /** |
| 72 | + * @return the local address to bind from |
| 73 | + */ |
66 | 74 | InetAddress getLocalAddress();
|
67 | 75 |
|
68 | 76 | /**
|
69 |
| - * Return the current set of Headers. |
70 |
| - * |
71 |
| - * @return a {@link HttpHeaders} contains headers. |
| 77 | + * @return the HTTP headers |
72 | 78 | */
|
73 | 79 | HttpHeaders getHeaders();
|
74 | 80 |
|
75 | 81 | /**
|
76 |
| - * Return cookies. |
77 |
| - * |
78 |
| - * @return an unmodifiable Collection of Cookies |
| 82 | + * @return the HTTP cookies |
79 | 83 | */
|
80 | 84 | List<Cookie> getCookies();
|
81 | 85 |
|
82 | 86 | /**
|
83 |
| - * Return the current request's body as a byte array |
84 |
| - * |
85 |
| - * @return a byte array of the current request's body. |
| 87 | + * @return the request's body byte array (only non null if it was set this way) |
86 | 88 | */
|
87 | 89 | byte[] getByteData();
|
88 | 90 |
|
89 | 91 | /**
|
90 |
| - * @return the current request's body as a composite of byte arrays |
| 92 | + * @return the request's body array of byte arrays (only non null if it was set this way) |
91 | 93 | */
|
92 | 94 | List<byte[]> getCompositeByteData();
|
93 | 95 |
|
94 | 96 | /**
|
95 |
| - * Return the current request's body as a string |
96 |
| - * |
97 |
| - * @return an String representation of the current request's body. |
| 97 | + * @return the request's body string (only non null if it was set this way) |
98 | 98 | */
|
99 | 99 | String getStringData();
|
100 | 100 |
|
101 | 101 | /**
|
102 |
| - * Return the current request's body as a ByteBuffer |
103 |
| - * |
104 |
| - * @return a ByteBuffer |
| 102 | + * @return the request's body ByteBuffer (only non null if it was set this way) |
105 | 103 | */
|
106 | 104 | ByteBuffer getByteBufferData();
|
107 | 105 |
|
108 | 106 | /**
|
109 |
| - * Return the current request's body as an InputStream |
110 |
| - * |
111 |
| - * @return an InputStream representation of the current request's body. |
| 107 | + * @return the request's body InputStream (only non null if it was set this way) |
112 | 108 | */
|
113 | 109 | InputStream getStreamData();
|
114 | 110 |
|
115 | 111 | /**
|
116 |
| - * Return the current request's body generator. |
117 |
| - * |
118 |
| - * @return A generator for the request body. |
| 112 | + * @return the request's body BodyGenerator (only non null if it was set this way) |
119 | 113 | */
|
120 | 114 | BodyGenerator getBodyGenerator();
|
121 | 115 |
|
122 | 116 | /**
|
123 |
| - * Return the current form parameters. |
124 |
| - * |
125 |
| - * @return the form parameters. |
| 117 | + * @return the request's form parameters |
126 | 118 | */
|
127 | 119 | List<Param> getFormParams();
|
128 | 120 |
|
129 | 121 | /**
|
130 |
| - * Return the current {@link Part} |
131 |
| - * |
132 |
| - * @return the current {@link Part} |
| 122 | + * @return the multipart parts |
133 | 123 | */
|
134 | 124 | List<Part> getBodyParts();
|
135 | 125 |
|
136 | 126 | /**
|
137 |
| - * Return the virtual host value. |
138 |
| - * |
139 |
| - * @return the virtual host value. |
| 127 | + * @return the virtual host to connect to |
140 | 128 | */
|
141 | 129 | String getVirtualHost();
|
142 | 130 |
|
143 | 131 | /**
|
144 |
| - * Return the query params. |
145 |
| - * |
146 |
| - * @return the query parameters |
| 132 | + * @return the query params resolved from the url/uri |
147 | 133 | */
|
148 | 134 | List<Param> getQueryParams();
|
149 | 135 |
|
150 | 136 | /**
|
151 |
| - * Return the {@link ProxyServer} |
152 |
| - * |
153 |
| - * @return the {@link ProxyServer} |
| 137 | + * @return the proxy server to be used to perform this request (overrides the one defined in config) |
154 | 138 | */
|
155 | 139 | ProxyServer getProxyServer();
|
156 | 140 |
|
157 | 141 | /**
|
158 |
| - * Return the {@link Realm} |
159 |
| - * |
160 |
| - * @return the {@link Realm} |
| 142 | + * @return the realm to be used to perform this request (overrides the one defined in config) |
161 | 143 | */
|
162 | 144 | Realm getRealm();
|
163 | 145 |
|
164 | 146 | /**
|
165 |
| - * Return the {@link File} to upload. |
166 |
| - * |
167 |
| - * @return the {@link File} to upload. |
| 147 | + * @return the file to be uploaded |
168 | 148 | */
|
169 | 149 | File getFile();
|
170 | 150 |
|
171 | 151 | /**
|
172 |
| - * Return follow redirect |
173 |
| - * |
174 |
| - * @return {@link Boolean#TRUE} to follow redirect, {@link Boolean#FALSE} if NOT to follow whatever the client config, null otherwise. |
| 152 | + * @return if this request is to follow redirects. Non null values means "override config value". |
175 | 153 | */
|
176 | 154 | Boolean getFollowRedirect();
|
177 | 155 |
|
178 | 156 | /**
|
179 |
| - * Overrides the config default value |
180 |
| - * @return the request timeout |
| 157 | + * @return the request timeout. Non zero values means "override config value". |
181 | 158 | */
|
182 | 159 | int getRequestTimeout();
|
183 | 160 |
|
184 | 161 | /**
|
185 |
| - * Return the HTTP Range header value, or |
186 |
| - * |
187 | 162 | * @return the range header value, or 0 is not set.
|
188 | 163 | */
|
189 | 164 | long getRangeOffset();
|
190 | 165 |
|
191 | 166 | /**
|
192 |
| - * Return the charset value used when decoding the request's body. |
193 |
| - * |
194 | 167 | * @return the charset value used when decoding the request's body.
|
195 | 168 | */
|
196 | 169 | Charset getCharset();
|
197 | 170 |
|
| 171 | + /** |
| 172 | + * @return the strategy to compute ChannelPool's keys |
| 173 | + */ |
198 | 174 | ChannelPoolPartitioning getChannelPoolPartitioning();
|
199 | 175 |
|
| 176 | + /** |
| 177 | + * @return the NameResolver to be used to resolve hostnams's IP |
| 178 | + */ |
200 | 179 | NameResolver<InetAddress> getNameResolver();
|
201 | 180 | }
|
0 commit comments