public abstract class RequestBuilder<T extends RequestBuilder<T>> extends Object
Request
Modifier and Type | Field and Description |
---|---|
protected List<Decoder<?,?>> |
decoders |
protected Class<T> |
derived |
protected List<Encoder<?,?>> |
encoders |
protected Map<String,Collection<String>> |
headers |
protected Request.METHOD |
method |
protected Map<String,List<String>> |
queryString |
protected FunctionResolver |
resolver |
protected List<Request.TRANSPORT> |
transports |
protected String |
uri |
Modifier | Constructor and Description |
---|---|
protected |
RequestBuilder(Class<T> derived) |
Modifier and Type | Method and Description |
---|---|
abstract Request |
build()
Build a
Request . |
T |
decoder(Decoder d)
Add a
Decoder . |
List<Decoder<?,?>> |
decoders()
Return the current list of
Decoder |
T |
encoder(Encoder e)
Add an
Encoder . |
List<Encoder<?,?>> |
encoders()
Return the current list of
Encoder |
T |
header(String name,
String value)
Add a header.
|
Map<String,Collection<String>> |
headers()
Return the current tMap of headers
|
Request.METHOD |
method()
Return the HTTP method
|
T |
method(Request.METHOD method)
The method to use for connecting tho the remote server.
|
Map<String,List<String>> |
queryString()
Return the current query string/form param
|
T |
queryString(String name,
String value)
Add a query param.
|
FunctionResolver |
resolver()
Return the current
FunctionResolver |
T |
resolver(FunctionResolver resolver)
Add a
FunctionResolver |
T |
transport(Request.TRANSPORT t)
The
Request.TRANSPORT to use. |
List<Request.TRANSPORT> |
transports()
Return the current list of
Request.TRANSPORT |
String |
uri()
Return the uri
|
T |
uri(String uri)
The URI to connect to.
|
protected final List<Request.TRANSPORT> transports
protected Request.METHOD method
protected String uri
protected final Map<String,Collection<String>> headers
protected FunctionResolver resolver
protected final Class<T extends RequestBuilder<T>> derived
public T transport(Request.TRANSPORT t)
Request.TRANSPORT
to use. This method can be invoked several time and the library will loop over the list
until one Request.TRANSPORT
succeed. The first added is always the first used.t
- public T method(Request.METHOD method)
Request.METHOD.GET
method
- public T uri(String uri)
uri
- a uri to connect topublic T encoder(Encoder e)
Encoder
. Several Encoder can be added and will be invoked the order they were added. This method
doesn't allow duplicate.e
- an Encoder
public T decoder(Decoder d)
Decoder
. Several Decoder can be added and will be invoked the order they were added. This method doesn't allow
duplicate.d
- a Decoder
public T header(String name, String value)
name
- header namevalue
- header valuepublic T queryString(String name, String value)
name
- header namevalue
- header valuepublic T resolver(FunctionResolver resolver)
FunctionResolver
resolver
- a FunctionResolver
public abstract Request build()
Request
. IMPORTANT: if you are using stateful Decoder
, you must NOT call this method
more than once to prevent response corruption.Request
public List<Request.TRANSPORT> transports()
Request.TRANSPORT
Request.TRANSPORT
public Request.METHOD method()
public Map<String,Collection<String>> headers()
public Map<String,List<String>> queryString()
public List<Encoder<?,?>> encoders()
Encoder
Encoder
public List<Decoder<?,?>> decoders()
Decoder
Decoder
public String uri()
public FunctionResolver resolver()
FunctionResolver
FunctionResolver
Copyright © 2015. All Rights Reserved.