Package com.mastfrog.netty.http.client
package com.mastfrog.netty.http.client
Async HTTP Client
An asynchronous HTTP client using Netty 4.x or greater. The distinguishing feature of an asynchronous HTTP client is the ability to concurrently execute multiple requests using a smaller number of threads than there are requests. Another distinguishing feature is that the normal pattern of use is to provide a callback which will be called with the result of a response, rather than waiting for the response to be synchronously executed. The API here is inspired a bit by Node.js'http module; it is designed to (mostly) avoid the
Future pattern, which a number of similar libraries seem to be stuck on
(the point of async code is not not block; if an asynchronous
API is all about "here's a thing you can block on while we make an
asynchronous call" then it has failed).
For details and example usage, see
HttpClient.-
ClassDescriptionAllows network activity to be monitored in an HTTP clientStores cookies from responses and decorates requests with them where appropriate.A simple asynchronous HTTP client with an emphasis on ease of use and a simple callback-based API to discourage blocking calls - use
HttpClient.builder()to configure and create an instance.Builds an HTTP client.Encapsulates a setting that can be set on the Netty Bootstrap; not really an API class, but exposed so that the HttpClient constructor can be invoked directly if someone wants to (using HttpClientBuilder is much easier).Builds an HTTP request, allows for adding listeners for response events, and for launching such a request.Exception passed to onError when a redirect loop is encountered, or the redirect URL cannot be parsed.Object which can be attached to an HttpClient which intercept all requests and can modify them before they are sentReturned from launching an HTTP request; attach handlers using theon(Class<EventType>, Receiver<State<T>>))method.Processes an HTTP response - can be passed to HttpRequestBuilder.execute().State<T>Represents the current state of a request, used in notifications.State event when a connection has been achieved; payload is the Channel; invoking close() on it will abort.State event triggered when one chunk of content has arrived; if the server is using chunked transfer encoding, this state will be fired once for each chunk; when the FullContentReceived event is fired, there will be no more ContentReceived events.State event triggered when an exception is thrown somewhere in processing of the request or response.Convenience state event providing the entire response and its body as a FullHttpResponse.State event triggered when the entire response body has arrived.State event triggered when the response header has arrived, but not the response body.State event triggered when a redirect is followed.State event when the HTTP request is about to be sent; payload is the HTTP request (you can still modify headers, etc at this point).State event triggered when a timeout occurs.Enumeration of states a request can be in.