Package com.ning.http.client
Interface Request
public interface Request
The Request class can be used to construct HTTP request:
Request r = new RequestBuilder().setUrl("url")
.setRealm((new Realm.RealmBuilder()).setPrincipal(user)
.setPassword(admin)
.setRealmName("MyRealm")
.setScheme(Realm.AuthScheme.DIGEST).build());
-
Method Summary
Modifier and TypeMethodDescriptionReturn the encoding value used when encoding the request's body.Return the current request's body generator.byte[]Return the current request's body as a byte arrayList<byte[]>longReturn the current size of the content-lenght header based on the body's size.Return Coookie.getFile()Return theFileto upload.Return follow redirectReturn the current form parameters.Return the current set of Headers.Return the InetAddress to overrideReturn the request's method name (GET, POST, etc.)getParts()Return the currentPartsReturn theProxyServerReturn the query params.longReturn the HTTP Range header value, orgetRealm()Return theRealmintOverrides the config default valueReturn the current request's body as an InputStreamReturn the current request's body as a stringgetUri()getUrl()Return the virtual host value.
-
Method Details
-
getMethod
String getMethod()Return the request's method name (GET, POST, etc.)- Returns:
- the request's method name (GET, POST, etc.)
-
getUri
Uri getUri() -
getUrl
String getUrl() -
getInetAddress
InetAddress getInetAddress()Return the InetAddress to override- Returns:
- the InetAddress
-
getLocalAddress
InetAddress getLocalAddress() -
getHeaders
FluentCaseInsensitiveStringsMap getHeaders()Return the current set of Headers.- Returns:
- a
FluentCaseInsensitiveStringsMapcontains headers.
-
getCookies
Collection<Cookie> getCookies()Return Coookie.- Returns:
- an unmodifiable Collection of Cookies
-
getByteData
byte[] getByteData()Return the current request's body as a byte array- Returns:
- a byte array of the current request's body.
-
getCompositeByteData
List<byte[]> getCompositeByteData()- Returns:
- the current request's body as a composite of byte arrays
-
getStringData
String getStringData()Return the current request's body as a string- Returns:
- an String representation of the current request's body.
-
getStreamData
InputStream getStreamData()Return the current request's body as an InputStream- Returns:
- an InputStream representation of the current request's body.
-
getBodyGenerator
BodyGenerator getBodyGenerator()Return the current request's body generator.- Returns:
- A generator for the request body.
-
getContentLength
long getContentLength()Return the current size of the content-lenght header based on the body's size.- Returns:
- the current size of the content-lenght header based on the body's size.
-
getFormParams
Return the current form parameters. -
getParts
Return the currentParts- Returns:
- the current
Parts
-
getVirtualHost
String getVirtualHost()Return the virtual host value.- Returns:
- the virtual host value.
-
getQueryParams
Return the query params. -
getProxyServer
ProxyServer getProxyServer()Return theProxyServer- Returns:
- the
ProxyServer
-
getRealm
Realm getRealm()Return theRealm- Returns:
- the
Realm
-
getFile
File getFile()Return theFileto upload.- Returns:
- the
Fileto upload.
-
getFollowRedirect
Boolean getFollowRedirect()Return follow redirect- Returns:
- the TRUE> to follow redirect, FALSE, if NOT to follow, whatever the client config. Return null if not set.
-
getRequestTimeout
int getRequestTimeout()Overrides the config default value- Returns:
- the request timeout
-
getRangeOffset
long getRangeOffset()Return the HTTP Range header value, or- Returns:
- the range header value, or 0 is not set.
-
getBodyEncoding
String getBodyEncoding()Return the encoding value used when encoding the request's body.- Returns:
- the encoding value used when encoding the request's body.
-
getConnectionPoolPartitioning
ConnectionPoolPartitioning getConnectionPoolPartitioning() -
getNameResolver
NameResolver getNameResolver()
-