public class Request<T extends Request<T>> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected T |
_this |
protected io.netty.channel.Channel |
channel |
protected Function1<io.netty.bootstrap.Bootstrap> |
conf |
protected io.netty.channel.ChannelFuture |
connectFuture |
protected io.netty.buffer.ByteBuf |
contents |
protected List<io.netty.handler.codec.http.Cookie> |
cookies |
protected FutureResponse |
future |
protected io.netty.channel.EventLoopGroup |
group |
protected io.netty.handler.codec.http.HttpMethod |
method |
protected URI |
originalUri |
protected RetryPolicy |
policy |
protected String |
proxyHost |
protected String |
proxyPass |
protected int |
proxyPort |
protected io.netty.handler.codec.http.DefaultFullHttpRequest |
proxyRequest |
protected String |
proxyUser |
protected Map<String,Object> |
queryParams |
protected Set<Integer> |
redirectStatusCodes |
protected io.netty.handler.codec.http.HttpRequest |
request |
protected Response |
response |
protected String[] |
sslProtocols |
protected boolean |
tunneling |
protected URI |
uri |
protected String |
userAgent |
protected boolean |
useSSL |
static Charset |
UTF8 |
protected io.netty.handler.codec.http.HttpVersion |
version |
| Constructor and Description |
|---|
Request(HttpRequestBuilder builder,
io.netty.channel.EventLoopGroup group,
URI uri,
io.netty.handler.codec.http.HttpMethod method,
io.netty.handler.codec.http.HttpVersion version,
Reader responseReader) |
| Modifier and Type | Method and Description |
|---|---|
void |
baseDirectory(String baseDir) |
protected void |
configure() |
protected void |
configureProxy(boolean ssl) |
protected io.netty.channel.ChannelFuture |
connect(String host,
int port,
io.netty.bootstrap.Bootstrap bootstrap) |
T |
cookie(io.netty.handler.codec.http.Cookie cookie)
Adds a cookie to this request
|
T |
cookie(String name,
Object value)
Adds a cookie with the given name and value
|
List<io.netty.handler.codec.http.Cookie> |
cookies() |
void |
deleteTempFileOnExit(boolean delete) |
FutureResponse |
execute() |
FutureResponse |
execute(Function1<io.netty.bootstrap.Bootstrap> conf)
Makes the request to the server
|
io.netty.channel.Channel |
getChannel() |
protected String |
getHost() |
protected int |
getPort(String scheme) |
protected String |
getProxyPath() |
protected String |
getScheme() |
T |
header(String name,
Iterable<?> value)
Set a header on this request
|
T |
header(String name,
Object value)
Set a header on this request
|
T |
header(String name,
String value)
Set a header on this request
|
io.netty.handler.codec.http.HttpHeaders |
headers() |
boolean |
isProxyEnabled()
Uses the proxy host to determine if proxy is enabled for this request.
|
protected boolean |
isSSLScheme(String scheme) |
protected io.netty.channel.ChannelFuture |
makeTheRequest() |
io.netty.handler.codec.http.HttpRequest |
nettyRequest() |
protected io.netty.channel.SimpleChannelInboundHandler<Object> |
newHandler() |
protected io.netty.channel.ChannelHandler |
newInitializer() |
protected void |
newNettyRequest(URI uri,
io.netty.handler.codec.http.HttpMethod method,
io.netty.handler.codec.http.HttpVersion version) |
URI |
originalUri() |
T |
policy(RetryPolicy policy)
Set the retry policy that will be used to retry a request if it fails.
|
T |
proxy(String host,
int port) |
T |
proxy(String host,
int port,
String username,
String password)
Sets proxy information what will be used to make the request
These proxy settings apply only to this request, not any other made after
|
T |
query(String name,
Object value)
Adds a query string parameter to the request
|
Set<Integer> |
redirectOn() |
T |
redirectOn(int... codes)
Automatically follow redirect responses for the given status codes
|
Response |
response() |
void |
retry() |
Set<Integer> |
retryOn() |
T |
retryOn(int... statusCodes)
Automatically retry the connection using the configured retry policy
|
protected void |
retryOrFail(Throwable cause,
boolean connectFailure) |
void |
shutdown() |
URI |
url() |
T |
url(String url) |
T |
userAgent(String agent) |
T |
withSSLProtocols(String[] protocols) |
public static final Charset UTF8
protected final Response response
protected final FutureResponse future
protected final io.netty.channel.EventLoopGroup group
protected final io.netty.handler.codec.http.HttpMethod method
protected io.netty.handler.codec.http.HttpRequest request
protected URI uri
protected io.netty.channel.Channel channel
protected String userAgent
protected List<io.netty.handler.codec.http.Cookie> cookies
protected String proxyHost
protected String proxyUser
protected String proxyPass
protected int proxyPort
protected io.netty.handler.codec.http.HttpVersion version
protected URI originalUri
protected io.netty.handler.codec.http.DefaultFullHttpRequest proxyRequest
protected io.netty.channel.ChannelFuture connectFuture
protected boolean useSSL
protected boolean tunneling
protected String[] sslProtocols
protected final io.netty.buffer.ByteBuf contents
protected Function1<io.netty.bootstrap.Bootstrap> conf
protected RetryPolicy policy
public Request(HttpRequestBuilder builder, io.netty.channel.EventLoopGroup group, URI uri, io.netty.handler.codec.http.HttpMethod method, io.netty.handler.codec.http.HttpVersion version, Reader responseReader)
public void deleteTempFileOnExit(boolean delete)
delete - should delete temp file on exit (on normal exit) if truepublic void baseDirectory(String baseDir)
baseDir - system temp directory by defaultprotected void newNettyRequest(URI uri, io.netty.handler.codec.http.HttpMethod method, io.netty.handler.codec.http.HttpVersion version)
public T redirectOn(int... codes)
codes - the status codes to treat as redirectspublic io.netty.handler.codec.http.HttpHeaders headers()
public Set<Integer> redirectOn()
public FutureResponse execute()
public FutureResponse execute(Function1<io.netty.bootstrap.Bootstrap> conf)
public void retry()
protected void retryOrFail(Throwable cause, boolean connectFailure)
public T policy(RetryPolicy policy)
public T retryOn(int... statusCodes)
protected String getScheme()
protected String getHost()
protected int getPort(String scheme)
protected boolean isSSLScheme(String scheme)
public boolean isProxyEnabled()
proxyHost is not null and is not emptyprotected void configureProxy(boolean ssl)
protected io.netty.channel.ChannelHandler newInitializer()
protected io.netty.channel.ChannelFuture connect(String host, int port, io.netty.bootstrap.Bootstrap bootstrap)
protected io.netty.channel.ChannelFuture makeTheRequest()
protected String getProxyPath()
protected io.netty.channel.SimpleChannelInboundHandler<Object> newHandler()
public io.netty.channel.Channel getChannel()
public T proxy(String host, int port, String username, String password)
host - the proxy hostport - the proxy portusername - username for the proxypassword - password for the proxypublic T query(String name, Object value)
name - the name of the query stringvalue - the valuepublic T cookie(io.netty.handler.codec.http.Cookie cookie)
cookie - the cookie to addpublic T cookie(String name, Object value)
name - the namevalue - the valuepublic List<io.netty.handler.codec.http.Cookie> cookies()
public void shutdown()
public Response response()
public URI originalUri()
public URI url()
public T url(String url) throws URISyntaxException
URISyntaxExceptionpublic io.netty.handler.codec.http.HttpRequest nettyRequest()
Copyright © 2012-2015. All Rights Reserved.