A reactive wrapper over Jetty's HttpClient Request.
A ReactiveRequest can be obtained via a builder:
// Built with HttpClient and a string URI. ReactiveRequest request = ReactiveRequest.newBuilder(httpClient, uri()).build(); // Built by wrapping a Request. Request req = httpClient.newRequest(...); ... ReactiveRequest request = ReactiveRequest.newBuilder(req).build();
Once created, a ReactiveRequest can be sent to obtain a Publisher
for a ReactiveResponse passing a function that handles the response
content:
Publisher<T> response = request.response((response, content) -> { ... });
| Modifier and Type | Class and Description |
|---|---|
| public static class | ReactiveRequest.Builder
A Builder for ReactiveRequest. |
| public static interface | ReactiveRequest.Content
A Publisher of content chunks that also specifies the content length and type. |
| public static class | ReactiveRequest.Event
A ReactiveRequest event. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final Request | |
| private final RequestEventPublisher | |
| private volatile ReactiveResponse | |
| private final ResponseEventPublisher |
| Access | Constructor and Description |
|---|---|
| protected | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ReactiveResponse | Returns: the ReactiveResponse correspondent to this request, or null if the response is not available yet
|
| public Request | |
| public static ReactiveRequest. | Returns: a builder for a GET request for the given URIthe HttpClient instance httpClient, String the target URI for the request - must be properly encoded already uri)
|
| public static ReactiveRequest. | |
| public Publisher | |
| public Publisher | Returns: a Publisher for the responseCreates a Publisher that sends the request when a Subscriber requests the response
via |
| public < the element type of the processed response content T> Publisher | Returns: a Publisher for the processed contentthe function that processes the response content contentFnCreates a Publisher that sends the request when a Subscriber requests the response
via |
| public Publisher | |
| public String |
| abortOnCancel | back to summary |
|---|---|
| private final boolean abortOnCancel | |
| request | back to summary |
|---|---|
| private final Request request | |
| requestEvents | back to summary |
|---|---|
| private final RequestEventPublisher requestEvents | |
| response | back to summary |
|---|---|
| private volatile ReactiveResponse response | |
| responseEvents | back to summary |
|---|---|
| private final ResponseEventPublisher responseEvents | |
| ReactiveRequest | back to summary |
|---|---|
| protected ReactiveRequest(Request request) | |
| ReactiveRequest | back to summary |
|---|---|
| private ReactiveRequest(Request request, boolean abortOnCancel) | |
| getReactiveResponse | back to summary |
|---|---|
public ReactiveResponse getReactiveResponse()
| |
| getRequest | back to summary |
|---|---|
public Request getRequest()
| |
| newBuilder | back to summary |
|---|---|
public static ReactiveRequest.
| |
| newBuilder | back to summary |
|---|---|
public static ReactiveRequest.
| |
| requestEvents | back to summary |
|---|---|
public Publisher
| |
| response | back to summary |
|---|---|
| public Publisher Creates a Publisher that sends the request when a Subscriber requests the response
via
| |
| response | back to summary |
|---|---|
| public <T> Publisher Creates a Publisher that sends the request when a Subscriber requests the response
via The given Applications must subscribe (possibly asynchronously) to the response content Publisher, even if it is known that the response has no content, to receive the response success/failure events. The response content Publisher emits
| |
| responseEvents | back to summary |
|---|---|
| public Publisher | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final Request |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ReactiveRequest. | Returns: this instancewhether a request should be aborted when the
content subscriber cancels the subscription abortOnCancel)
|
| public ReactiveRequest | |
| public ReactiveRequest. | Returns: this instancethe request content contentProvides the request content via a Publisher. |
| abortOnCancel | back to summary |
|---|---|
| private boolean abortOnCancel | |
| request | back to summary |
|---|---|
| private final Request request | |
| Builder | back to summary |
|---|---|
| public Builder(HttpClient client, String uri) | |
| Builder | back to summary |
|---|---|
| public Builder(Request request) | |
| abortOnCancel | back to summary |
|---|---|
public ReactiveRequest.
| |
| build | back to summary |
|---|---|
public ReactiveRequest build()
| |
| content | back to summary |
|---|---|
| public ReactiveRequest. Provides the request content via a Publisher.
| |
| Modifier and Type | Method and Description |
|---|---|
| public static ReactiveRequest. | |
| public static ReactiveRequest. | |
| public static ReactiveRequest. | |
| public String | |
| public long | |
| public default boolean |
| fromPublisher | back to summary |
|---|---|
| public static ReactiveRequest. Creates a Content from the given Publisher of The implementation will call | |
| fromPublisher | back to summary |
|---|---|
| public static ReactiveRequest. Creates a Content from the given Publisher of The implementation will call | |
| fromString | back to summary |
|---|---|
| public static ReactiveRequest. | |
| getContentType | back to summary |
|---|---|
public String getContentType()
| |
| getLength | back to summary |
|---|---|
public long getLength()
| |
| rewind | back to summary |
|---|---|
| public default boolean rewind() Rewinds this content, if possible.
| |
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ReactiveRequest.Event.Type
The event types |
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer | |
| private final Throwable | |
| private final ReactiveRequest | |
| private final ReactiveRequest. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| private | Event(ReactiveRequest.
|
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | |
| public Throwable | |
| public ReactiveRequest | |
| public ReactiveRequest. |
| content | back to summary |
|---|---|
| private final ByteBuffer content | |
| failure | back to summary |
|---|---|
| private final Throwable failure | |
| request | back to summary |
|---|---|
| private final ReactiveRequest request | |
| type | back to summary |
|---|---|
| private final ReactiveRequest. | |
| Event | back to summary |
|---|---|
| public Event(ReactiveRequest. | |
| Event | back to summary |
|---|---|
| public Event(ReactiveRequest. | |
| Event | back to summary |
|---|---|
| public Event(ReactiveRequest. | |
| Event | back to summary |
|---|---|
| private Event(ReactiveRequest. | |
| getContent | back to summary |
|---|---|
public ByteBuffer getContent()
| |
| getFailure | back to summary |
|---|---|
public Throwable getFailure()
| |
| getRequest | back to summary |
|---|---|
public ReactiveRequest getRequest()
| |
| getType | back to summary |
|---|---|
public ReactiveRequest.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final ReactiveRequest. | BEGIN
The request is ready to be sent |
| public static final ReactiveRequest. | COMMIT
The request headers have been sent |
| public static final ReactiveRequest. | CONTENT
A chunk of content has been sent |
| public static final ReactiveRequest. | FAILURE
The request failed |
| public static final ReactiveRequest. | HEADERS
The request headers have been prepared |
| public static final ReactiveRequest. | QUEUED
The request has been queued |
| public static final ReactiveRequest. | SUCCESS
The request succeeded |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ReactiveRequest. | |
| public static ReactiveRequest. |
| BEGIN | back to summary |
|---|---|
| public static final ReactiveRequest. The request is ready to be sent | |
| COMMIT | back to summary |
|---|---|
| public static final ReactiveRequest. The request headers have been sent | |
| CONTENT | back to summary |
|---|---|
| public static final ReactiveRequest. A chunk of content has been sent | |
| FAILURE | back to summary |
|---|---|
| public static final ReactiveRequest. The request failed | |
| HEADERS | back to summary |
|---|---|
| public static final ReactiveRequest. The request headers have been prepared | |
| QUEUED | back to summary |
|---|---|
| public static final ReactiveRequest. The request has been queued | |
| SUCCESS | back to summary |
|---|---|
| public static final ReactiveRequest. The request succeeded | |
| Type | back to summary |
|---|---|
| private Type() | |
| valueOf | back to summary |
|---|---|
| public static ReactiveRequest. | |
| values | back to summary |
|---|---|
| public static ReactiveRequest. | |