public interface

Request

com.ning.http.client.Request

Class Overview

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());
   r.execute();
 

Summary

Nested Classes
interface Request.EntityWriter An entity that can be used to manipulate the Request's body output before it get sent. 
Public Methods
abstract String getBodyEncoding()
Return the encoding value used when encoding the request's body.
abstract BodyGenerator getBodyGenerator()
Return the current request's body generator.
abstract byte[] getByteData()
Return the current request's body as a byte array
abstract long getContentLength()
Return the current size of the content-lenght header based on the body's size.
abstract Collection<Cookie> getCookies()
Return Coookie.
abstract Request.EntityWriter getEntityWriter()
Return the current request's body as an EntityWriter
abstract File getFile()
Return the File to upload.
abstract FluentCaseInsensitiveStringsMap getHeaders()
Return the current set of Headers.
abstract InetAddress getInetAddress()
Return the InetAddress to override
abstract long getLength()
This method is deprecated. No replacement.
abstract String getMethod()
Return the request's method name (GET, POST, etc.)
abstract FluentStringsMap getParams()
Return the current parameters.
abstract List<Part> getParts()
Return the current Part
abstract PerRequestConfig getPerRequestConfig()
Return Per request configuration.
abstract ProxyServer getProxyServer()
Return the ProxyServer
abstract FluentStringsMap getQueryParams()
Return the query params.
abstract long getRangeOffset()
Return the HTTP Range header value, or
abstract String getRawUrl()
Return the undecoded url
abstract Realm getRealm()
Return the Realm
abstract String getReqType()
This method is deprecated. - use getMethod
abstract InputStream getStreamData()
Return the current request's body as an InputStream
abstract String getStringData()
Return the current request's body as a string
abstract String getUrl()
Return the decoded url
abstract String getVirtualHost()
Return the virtual host value.
abstract boolean isRedirectEnabled()
Return the true> to follow redirect
abstract boolean isRedirectOverrideSet()
abstract boolean isUseRawUrl()

Public Methods

public abstract String getBodyEncoding ()

Return the encoding value used when encoding the request's body.

Returns
  • the encoding value used when encoding the request's body.

public abstract BodyGenerator getBodyGenerator ()

Return the current request's body generator.

Returns
  • A generator for the request body.

public abstract byte[] getByteData ()

Return the current request's body as a byte array

Returns
  • a byte array of the current request's body.

public abstract 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.

public abstract Collection<Cookie> getCookies ()

Return Coookie.

Returns
  • an unmodifiable Collection of Cookies

public abstract Request.EntityWriter getEntityWriter ()

Return the current request's body as an EntityWriter

Returns
  • an EntityWriter representation of the current request's body.

public abstract File getFile ()

Return the File to upload.

Returns
  • the File to upload.

public abstract FluentCaseInsensitiveStringsMap getHeaders ()

Return the current set of Headers.

Returns

public abstract InetAddress getInetAddress ()

Return the InetAddress to override

Returns
  • the InetAddress

public abstract long getLength ()

This method is deprecated.
No replacement.

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.

public abstract String getMethod ()

Return the request's method name (GET, POST, etc.)

Returns
  • the request's method name (GET, POST, etc.)

public abstract FluentStringsMap getParams ()

Return the current parameters.

Returns

public abstract List<Part> getParts ()

Return the current Part

Returns

public abstract PerRequestConfig getPerRequestConfig ()

Return Per request configuration.

Returns
  • Per request configuration.

public abstract ProxyServer getProxyServer ()

Return the ProxyServer

Returns

public abstract FluentStringsMap getQueryParams ()

Return the query params.

Returns

public abstract long getRangeOffset ()

Return the HTTP Range header value, or

Returns
  • the range header value, or 0 is not set.

public abstract String getRawUrl ()

Return the undecoded url

Returns
  • the undecoded url

public abstract Realm getRealm ()

Return the Realm

Returns

public abstract String getReqType ()

This method is deprecated.
- use getMethod

Return the request's type (GET, POST, etc.)

Returns
  • the request's type (GET, POST, etc.)

public abstract InputStream getStreamData ()

Return the current request's body as an InputStream

Returns
  • an InputStream representation of the current request's body.

public abstract String getStringData ()

Return the current request's body as a string

Returns
  • an String representation of the current request's body.

public abstract String getUrl ()

Return the decoded url

Returns
  • the decoded url

public abstract String getVirtualHost ()

Return the virtual host value.

Returns
  • the virtual host value.

public abstract boolean isRedirectEnabled ()

Return the true> to follow redirect

Returns
  • the true> to follow redirect

public abstract boolean isRedirectOverrideSet ()

Returns
  • true> if request's redirectEnabled setting should be used in place of client's

public abstract boolean isUseRawUrl ()