Top Fields Constructors Methods
org.eclipse.jetty.client.transport

public Class HttpRequest

extends Object
implements Request
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.client.Request
Known Direct Subclasses
org.eclipse.jetty.client.internal.TunnelRequest
Imports
java.io.IOException, java.net.URI, .URISyntaxException, .URLDecoder, .URLEncoder, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.nio.file.Path, java.util.ArrayList, .Collections, .EnumSet, .HashMap, .Iterator, .List, .Locale, .Map, .Objects, java.util.concurrent.CompletableFuture, .ExecutionException, .TimeUnit, .TimeoutException, java.util.concurrent.atomic.AtomicReference, java.util.function.BiFunction, .Consumer, .Supplier, org.eclipse.jetty.client.CompletableResponseListener, .Connection, .ContentResponse, .Destination, .HttpClient, .Origin, .PathRequestContent, .Request, .RequestListeners, .Response, org.eclipse.jetty.client.internal.NotifyingRequestListeners, org.eclipse.jetty.http.HttpCookie, .HttpField, .HttpFields, .HttpHeader, .HttpMethod, .HttpVersion, org.eclipse.jetty.util.Fields, .NanoTime, .Promise, .URIUtil

Field Summary

Modifier and TypeField and Description
private final AtomicReference<Throwable>
private Map<String, Object>
private final HttpClient
private Connection
private Request.Content
private final HttpConversation
private List<HttpCookie>
private boolean
private final HttpFields.Mutable
private String
private long
private String
private boolean
private static final URI
private final Fields
private String
private int
private BiFunction<Request, Request, Response.CompleteListener>
private String
private NotifyingRequestListeners
private final ResponseListeners
private String
private Object
private long
private long
private Supplier<HttpFields>
private URI
private HttpVersion
private boolean

Constructor Summary

AccessConstructor and Description
public
HttpRequest(HttpClient client, HttpConversation conversation, URI uri)

Method Summary

Modifier and TypeMethod and Description
public CompletableFuture<Boolean>
abort(Throwable
the abort cause, must not be null
cause
)

Implements org.eclipse.jetty.client.Request.abort.

Attempts to abort the send of this request.

public Request
accept(String...
the media types that are acceptable in the response, such as "text/plain;q=0.5" or "text/html" (corresponds to the Accept header)
accepts
)

Implements org.eclipse.jetty.client.Request.accept.

public HttpRequest
public Request
agent(String
the user agent for this request (corresponds to the User-Agent header)
agent
)

Implements org.eclipse.jetty.client.Request.agent.

public Request
attribute(String
the name of the attribute
name
,
Object
the value of the attribute
value
)

Implements org.eclipse.jetty.client.Request.attribute.

public Request
body(Request.Content
the request content of this request
content
)

Implements org.eclipse.jetty.client.Request.body.

private String
private URI
buildURI(boolean withQuery)

public HttpRequest
copy(URI newURI)

protected HttpRequest
copyInstance(URI newURI)

private void
public Request
file(Path
the file to upload
file
)

Implements org.eclipse.jetty.client.Request.file.

Shortcut method to specify a file as a content for this request, with the default content type of "application/octet-stream".

public Request
file(Path
the file to upload
file
,
String
the content type of the file
contentType
)

Implements org.eclipse.jetty.client.Request.file.

Shortcut method to specify a file as a content for this request, with the given content type.

public Request
followRedirects(boolean
whether this request follows redirects
follow
)

Implements org.eclipse.jetty.client.Request.followRedirects.

public Throwable
public String
public Map<String, Object>
public Request.Content
public Connection
getConnection()

Overrides default org.eclipse.jetty.client.Request.getConnection.

Returns the connection associated with this request.

public HttpConversation
public List<HttpCookie>
public HttpFields
public String
protected HttpClient
private NotifyingRequestListeners
public long
public String
public Fields
public String
public int
public BiFunction<Request, Request, Response.CompleteListener>
public String
public ResponseListeners
public String
public Object
public long
public long
getTimeoutNanoTime()

Returns: The nanoTime at which the timeout expires or Long#MAX_VALUE if there is no timeout.

public Supplier<HttpFields>
public URI
public HttpVersion
public Request
headers(Consumer<HttpFields.Mutable>
the code that modifies the headers of this request
consumer
)

Implements org.eclipse.jetty.client.Request.headers.

Modifies the headers of this request.

public Request
host(String
the URI host of this request, such as "127.0.0.1" or "google.com"
host
)

Overrides default org.eclipse.jetty.client.Request.host.

public Request
idleTimeout(long
the idle timeout for this request
timeout
,
TimeUnit
the idle timeout unit
unit
)

Implements org.eclipse.jetty.client.Request.idleTimeout.

public boolean
public boolean
public Request
listener(Request.Listener
a listener for request events
listener
)

Implements org.eclipse.jetty.client.Request.listener.

public Request
method(HttpMethod
the method of this request, such as GET or POST
method
)

Implements org.eclipse.jetty.client.Request.method.

public Request
method(String
the method of this request, such as GET or POST
method
)

Implements org.eclipse.jetty.client.Request.method.

private URI
newURI(String path)

pack-priv boolean

Returns:

whether this request was already normalized
normalized
()

Marks this request as normalized.

public void
public void
public void
public void
public void
public void
public void
public Request
onComplete(Response.CompleteListener
a listener for complete event
listener
)

Implements org.eclipse.jetty.client.Request.onComplete.

public Request
onPush(BiFunction<Request, Request, Response.CompleteListener>
a handler for pushed resource events
pushHandler
)

Implements org.eclipse.jetty.client.Request.onPush.

Sets a handler for pushed resources.

public Request
onRequestBegin(Request.BeginListener
a listener for request begin event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestBegin.

public Request
onRequestCommit(Request.CommitListener
a listener for request commit event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestCommit.

public Request
onRequestContent(Request.ContentListener
a listener for request content events
listener
)

Implements org.eclipse.jetty.client.Request.onRequestContent.

public Request
onRequestFailure(Request.FailureListener
a listener for request failure event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestFailure.

public Request
onRequestHeaders(Request.HeadersListener
a listener for request headers event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestHeaders.

public Request
onRequestQueued(Request.QueuedListener
a listener for request queued event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestQueued.

public Request
onRequestSuccess(Request.SuccessListener
a listener for request success event
listener
)

Implements org.eclipse.jetty.client.Request.onRequestSuccess.

public Request
onResponseBegin(Response.BeginListener
a listener for response begin event
listener
)

Implements org.eclipse.jetty.client.Request.onResponseBegin.

public Request
onResponseContent(Response.ContentListener
a consuming listener for response content events
listener
)

Implements org.eclipse.jetty.client.Request.onResponseContent.

public Request
onResponseContentAsync(Response.AsyncContentListener
an asynchronous listener for response content events
listener
)

Implements org.eclipse.jetty.client.Request.onResponseContentAsync.

public Request
public Request
onResponseFailure(Response.FailureListener
a listener for response failure event
listener
)

Implements org.eclipse.jetty.client.Request.onResponseFailure.

public Request
onResponseHeader(Response.HeaderListener
a listener for response header event
listener
)

Implements org.eclipse.jetty.client.Request.onResponseHeader.

public Request
onResponseHeaders(Response.HeadersListener
a listener for response headers event
listener
)

Implements org.eclipse.jetty.client.Request.onResponseHeaders.

Registers a listener for the headers event.

public Request
onResponseSuccess(Response.SuccessListener
a listener for response success event
listener
)

Implements org.eclipse.jetty.client.Request.onResponseSuccess.

public Request
param(String
the name of the query parameter
name
,
String
the value of the query parameter
value
)

Implements org.eclipse.jetty.client.Request.param.

Adds a URI query parameter with the given name and value.

private Request
param(String name, String value, boolean fromQuery)

public Request
path(String
the URI path of this request, such as "/" or "/path?param=1"
path
)

Implements org.eclipse.jetty.client.Request.path.

Specifies the URI path - and possibly the query - of this request.

public Request
port(int
the URI port of this request such as 80 or 443
port
)

Overrides default org.eclipse.jetty.client.Request.port.

private RequestListeners
public Request
scheme(String
the URI scheme of this request, such as "http" or "https"
scheme
)

Implements org.eclipse.jetty.client.Request.scheme.

public ContentResponse
send()

Implements org.eclipse.jetty.client.Request.send.

Sends this request and returns the response.

public void
send(Response.CompleteListener
the listener that receives response events
listener
)

Implements org.eclipse.jetty.client.Request.send.

Sends this request and asynchronously notifies the given listener for response events.

pack-priv void
pack-priv void
sent()

pack-priv void
public Request
tag(Object
the metadata to tag the request with
tag
)

Implements org.eclipse.jetty.client.Request.tag.

Tags this request with the given metadata tag.

public Request
timeout(long
the total timeout for the request/response conversation; use zero or a negative value to disable the timeout
timeout
,
TimeUnit
the timeout unit
unit
)

Implements org.eclipse.jetty.client.Request.timeout.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public Request
trailersSupplier(Supplier<HttpFields>
the supplier of the trailers of this request
trailers
)

Implements org.eclipse.jetty.client.Request.trailersSupplier.

Provides the trailers of this request.

private String
private String
public Request
version(HttpVersion
the HTTP version of this request, such as "HTTP/1.1"
version
)

Implements org.eclipse.jetty.client.Request.version.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait