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. Warning: mutable and not thread-safe! Beware that it holds a reference on the Request instance it builds, so modifying the builder will modify the request even after it has been built.


Field Summary
 
Fields inherited from class com.ning.http.client.RequestBuilderBase
queryComputer, queryParams, request, signatureCalculator
 
Constructor Summary
RequestBuilder()
           
RequestBuilder(Request prototype)
           
RequestBuilder(Request prototype, QueryComputer queryComputer)
           
RequestBuilder(String method)
           
RequestBuilder(String method, boolean useRawUrl)
           
RequestBuilder(String method, QueryComputer queryComputer)
           
 
Method Summary
 RequestBuilder addBodyPart(Part part)
           
 RequestBuilder addCookie(Cookie cookie)
           
 RequestBuilder addFormParam(String key, String value)
           
 RequestBuilder addHeader(String name, String value)
           
 RequestBuilder addOrReplaceCookie(Cookie c)
           
 RequestBuilder addQueryParam(String name, String value)
           
 RequestBuilder addQueryParams(List<Param> queryParams)
           
 Request build()
           
 RequestBuilder setBody(byte[] data)
           
 RequestBuilder setBody(InputStream stream)
          Deprecated. RequestBuilderBase.setBody(BodyGenerator) setBody(new InputStreamBodyGenerator(inputStream))
 RequestBuilder setBody(String data)
           
 RequestBuilder setFollowRedirects(boolean followRedirects)
           
 RequestBuilder setFormParams(List<Param> params)
           
 RequestBuilder setFormParams(Map<String,List<String>> params)
           
 RequestBuilder setHeader(String name, String value)
           
 RequestBuilder setHeaders(FluentCaseInsensitiveStringsMap headers)
           
 RequestBuilder setHeaders(Map<String,Collection<String>> headers)
           
 RequestBuilder setMethod(String method)
           
 RequestBuilder setProxyServer(ProxyServer proxyServer)
           
 RequestBuilder setQueryParams(List<Param> params)
           
 RequestBuilder setQueryParams(Map<String,List<String>> params)
           
 RequestBuilder setUrl(String url)
           
 RequestBuilder setVirtualHost(String virtualHost)
           
 
Methods inherited from class com.ning.http.client.RequestBuilderBase
resetCookies, resetFormParams, resetMultipartData, resetNonMultipartData, resetQuery, setBody, setBody, setBodyEncoding, setConnectionPoolKeyStrategy, setContentLength, setCookies, setInetAddress, setLocalInetAddress, setRangeOffset, setRealm, setRequestTimeoutInMs, setSignatureCalculator, setURI
 
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(String method,
                      QueryComputer queryComputer)

RequestBuilder

public RequestBuilder(Request prototype)

RequestBuilder

public RequestBuilder(Request prototype,
                      QueryComputer queryComputer)
Method Detail

addBodyPart

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

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>

addFormParam

public RequestBuilder addFormParam(String key,
                                   String value)
Overrides:
addFormParam in class RequestBuilderBase<RequestBuilder>

addQueryParam

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

addQueryParams

public RequestBuilder addQueryParams(List<Param> queryParams)
Overrides:
addQueryParams in class RequestBuilderBase<RequestBuilder>

setQueryParams

public RequestBuilder setQueryParams(List<Param> params)
Overrides:
setQueryParams in class RequestBuilderBase<RequestBuilder>

setQueryParams

public RequestBuilder setQueryParams(Map<String,List<String>> params)
Overrides:
setQueryParams in class RequestBuilderBase<RequestBuilder>

build

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

setBody

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

setBody

@Deprecated
public RequestBuilder setBody(InputStream stream)
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)
Overrides:
setBody in class RequestBuilderBase<RequestBuilder>

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>

setFormParams

public RequestBuilder setFormParams(List<Param> params)
Overrides:
setFormParams in class RequestBuilderBase<RequestBuilder>

setFormParams

public RequestBuilder setFormParams(Map<String,List<String>> params)
Overrides:
setFormParams in class RequestBuilderBase<RequestBuilder>

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 © 2014. All Rights Reserved.