com.ning.http.client
Class RequestBuilder

java.lang.Object
  extended by com.ning.http.client.RequestBuilderBase<RequestBuilder>
      extended by com.ning.http.client.RequestBuilder

public class RequestBuilder
extends RequestBuilderBase<RequestBuilder>

Builder for a Request.


Field Summary
 
Fields inherited from class com.ning.http.client.RequestBuilderBase
request, useRawUrl
 
Constructor Summary
RequestBuilder()
           
RequestBuilder(Request prototype)
           
RequestBuilder(String method)
           
RequestBuilder(String method, boolean useRawUrl)
           
 
Method Summary
 RequestBuilder addBodyPart(Part part)
           
 RequestBuilder addCookie(Cookie cookie)
           
 RequestBuilder addHeader(String name, String value)
           
 RequestBuilder addOrReplaceCookie(Cookie c)
           
 RequestBuilder addParameter(String key, String value)
           
 RequestBuilder addQueryParameter(String name, String value)
           
 Request build()
           
 RequestBuilder setBody(byte[] data)
           
 RequestBuilder setBody(InputStream stream)
          Deprecated. RequestBuilderBase.setBody(BodyGenerator) setBody(new InputStreamBodyGenerator(inputStream))
 RequestBuilder setBody(Request.EntityWriter dataWriter)
           
 RequestBuilder setBody(Request.EntityWriter dataWriter, long length)
           
 RequestBuilder setBody(String data)
           
 RequestBuilder setFollowRedirects(boolean followRedirects)
           
 RequestBuilder setHeader(String name, String value)
           
 RequestBuilder setHeaders(FluentCaseInsensitiveStringsMap headers)
           
 RequestBuilder setHeaders(Map<String,Collection<String>> headers)
           
 RequestBuilder setMethod(String method)
           
 RequestBuilder setParameters(FluentStringsMap parameters)
           
 RequestBuilder setParameters(Map<String,Collection<String>> parameters)
           
 RequestBuilder setProxyServer(ProxyServer proxyServer)
           
 RequestBuilder setQueryParameters(FluentStringsMap parameters)
           
 RequestBuilder setUrl(String url)
           
 RequestBuilder setVirtualHost(String virtualHost)
           
 
Methods inherited from class com.ning.http.client.RequestBuilderBase
setBody, setBody, setBodyEncoding, setContentLength, setPerRequestConfig, setRangeOffset, setRealm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestBuilder

public RequestBuilder()

RequestBuilder

public RequestBuilder(String method)

RequestBuilder

public RequestBuilder(String method,
                      boolean useRawUrl)

RequestBuilder

public RequestBuilder(Request prototype)
Method Detail

addBodyPart

public RequestBuilder addBodyPart(Part part)
                           throws IllegalArgumentException
Overrides:
addBodyPart in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

addCookie

public RequestBuilder addCookie(Cookie cookie)
Overrides:
addCookie in class RequestBuilderBase<RequestBuilder>

addHeader

public RequestBuilder addHeader(String name,
                                String value)
Overrides:
addHeader in class RequestBuilderBase<RequestBuilder>

addParameter

public RequestBuilder addParameter(String key,
                                   String value)
                            throws IllegalArgumentException
Overrides:
addParameter in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

addQueryParameter

public RequestBuilder addQueryParameter(String name,
                                        String value)
Overrides:
addQueryParameter in class RequestBuilderBase<RequestBuilder>

setQueryParameters

public RequestBuilder setQueryParameters(FluentStringsMap parameters)
Overrides:
setQueryParameters in class RequestBuilderBase<RequestBuilder>

build

public Request build()
Overrides:
build in class RequestBuilderBase<RequestBuilder>

setBody

public RequestBuilder setBody(byte[] data)
                       throws IllegalArgumentException
Overrides:
setBody in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

setBody

public RequestBuilder setBody(Request.EntityWriter dataWriter,
                              long length)
                       throws IllegalArgumentException
Overrides:
setBody in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

setBody

public RequestBuilder setBody(Request.EntityWriter dataWriter)
Overrides:
setBody in class RequestBuilderBase<RequestBuilder>

setBody

@Deprecated
public RequestBuilder setBody(InputStream stream)
                       throws IllegalArgumentException
Deprecated. RequestBuilderBase.setBody(BodyGenerator) setBody(new InputStreamBodyGenerator(inputStream))

Deprecated - Use setBody(new InputStreamBodyGenerator(inputStream)).

Overrides:
setBody in class RequestBuilderBase<RequestBuilder>
Parameters:
stream - - An InputStream
Returns:
a RequestBuilder
Throws:
IllegalArgumentException
See Also:
InputStreamBodyGenerator(inputStream), InputStreamBodyGenerator

setBody

public RequestBuilder setBody(String data)
                       throws IllegalArgumentException
Overrides:
setBody in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

setHeader

public RequestBuilder setHeader(String name,
                                String value)
Overrides:
setHeader in class RequestBuilderBase<RequestBuilder>

setHeaders

public RequestBuilder setHeaders(FluentCaseInsensitiveStringsMap headers)
Overrides:
setHeaders in class RequestBuilderBase<RequestBuilder>

setHeaders

public RequestBuilder setHeaders(Map<String,Collection<String>> headers)
Overrides:
setHeaders in class RequestBuilderBase<RequestBuilder>

setParameters

public RequestBuilder setParameters(Map<String,Collection<String>> parameters)
                             throws IllegalArgumentException
Overrides:
setParameters in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

setParameters

public RequestBuilder setParameters(FluentStringsMap parameters)
                             throws IllegalArgumentException
Overrides:
setParameters in class RequestBuilderBase<RequestBuilder>
Throws:
IllegalArgumentException

setMethod

public RequestBuilder setMethod(String method)
Overrides:
setMethod in class RequestBuilderBase<RequestBuilder>

setUrl

public RequestBuilder setUrl(String url)
Overrides:
setUrl in class RequestBuilderBase<RequestBuilder>

setProxyServer

public RequestBuilder setProxyServer(ProxyServer proxyServer)
Overrides:
setProxyServer in class RequestBuilderBase<RequestBuilder>

setVirtualHost

public RequestBuilder setVirtualHost(String virtualHost)
Overrides:
setVirtualHost in class RequestBuilderBase<RequestBuilder>

setFollowRedirects

public RequestBuilder setFollowRedirects(boolean followRedirects)
Overrides:
setFollowRedirects in class RequestBuilderBase<RequestBuilder>

addOrReplaceCookie

public RequestBuilder addOrReplaceCookie(Cookie c)
Overrides:
addOrReplaceCookie in class RequestBuilderBase<RequestBuilder>


Copyright © 2011. All Rights Reserved.