Class HttpClient
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.client.HttpClient
-
- All Implemented Interfaces:
Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
@ManagedObject("The HTTP client") @Deprecated(since="2021-05-27") public class HttpClient extends ContainerLifeCycle
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.HttpClient
provides an efficient, asynchronous, non-blocking implementation to perform HTTP requests to a server through a simple API that offers also blocking semantic.HttpClient
provides easy-to-use methods such asGET(String)
that allow to perform HTTP requests in a one-liner, but also gives the ability to fine tune the configuration of requests vianewRequest(URI)
.HttpClient
acts as a central configuration point for network parameters (such as idle timeouts) and HTTP parameters (such as whether to follow redirects).HttpClient
transparently pools connections to servers, but allows direct control of connections for cases where this is needed.HttpClient
also acts as a central configuration point for cookies, viagetCookieStore()
.Typical usage:
HttpClient httpClient = new HttpClient(); httpClient.start(); // One liner: httpClient.GET("http://localhost:8080/").getStatus(); // Building a request with a timeout ContentResponse response = httpClient.newRequest("http://localhost:8080") .timeout(5, TimeUnit.SECONDS) .send(); int status = response.status(); // Asynchronously httpClient.newRequest("http://localhost:8080").send(new Response.CompleteListener() { @Override public void onComplete(Result result) { ... } });
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Constructor Description HttpClient()
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS destinations only (that is, requests with the "http" scheme only, and not "https").HttpClient(HttpClientTransport transport)
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS destinations only (that is, requests with the "http" scheme only, and not "https").HttpClient(HttpClientTransport transport, SslContextFactory sslContextFactory)
Deprecated.HttpClient(SslContextFactory sslContextFactory)
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS and TLS destinations (that is, both requests with the "http" scheme and with the "https" scheme).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
dump(java.lang.Appendable out, java.lang.String indent)
Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.ContentResponse
FORM(java.lang.String uri, Fields fields)
Deprecated.Performs a POST request to the specified URI with the given form parameters.ContentResponse
FORM(java.net.URI uri, Fields fields)
Deprecated.Performs a POST request to the specified URI with the given form parameters.ContentResponse
GET(java.lang.String uri)
Deprecated.Performs a GET request to the specified URI.ContentResponse
GET(java.net.URI uri)
Deprecated.Performs a GET request to the specified URI.long
getAddressResolutionTimeout()
Deprecated.AuthenticationStore
getAuthenticationStore()
Deprecated.java.net.SocketAddress
getBindAddress()
Deprecated.ByteBufferPool
getByteBufferPool()
Deprecated.long
getConnectTimeout()
Deprecated.java.util.Set<ContentDecoder.Factory>
getContentDecoderFactories()
Deprecated.Returns a non thread-safe set ofContentDecoder.Factory
s that can be modified before performing requests.java.net.CookieStore
getCookieStore()
Deprecated.java.lang.String
getDefaultRequestContentType()
Deprecated.Destination
getDestination(java.lang.String scheme, java.lang.String host, int port)
Deprecated.Returns aDestination
for the given scheme, host and port.java.util.List<Destination>
getDestinations()
Deprecated.java.util.concurrent.Executor
getExecutor()
Deprecated.HttpCompliance
getHttpCompliance()
Deprecated.Gets the http compliance mode for parsing http responses.long
getIdleTimeout()
Deprecated.int
getMaxConnectionsPerDestination()
Deprecated.int
getMaxRedirects()
Deprecated.int
getMaxRequestsQueuedPerDestination()
Deprecated.java.lang.String
getName()
Deprecated.ProtocolHandlers
getProtocolHandlers()
Deprecated.ProxyConfiguration
getProxyConfiguration()
Deprecated.int
getRequestBufferSize()
Deprecated.java.util.List<Request.Listener>
getRequestListeners()
Deprecated.Returns a non thread-safe list ofRequest.Listener
s that can be modified before performing requests.int
getResponseBufferSize()
Deprecated.Scheduler
getScheduler()
Deprecated.SocketAddressResolver
getSocketAddressResolver()
Deprecated.SslContextFactory
getSslContextFactory()
Deprecated.HttpClientTransport
getTransport()
Deprecated.HttpField
getUserAgentField()
Deprecated.boolean
isConnectBlocking()
Deprecated.boolean
isDefaultPort(java.lang.String scheme, int port)
Deprecated.boolean
isDispatchIO()
Deprecated.boolean
isFollowRedirects()
Deprecated.boolean
isRemoveIdleDestinations()
Deprecated.boolean
isStrictEventOrdering()
Deprecated.boolean
isTCPNoDelay()
Deprecated.Request
newRequest(java.lang.String uri)
Deprecated.Creates a new request with the specified absolute URI in string format.Request
newRequest(java.lang.String host, int port)
Deprecated.Creates a new request with the "http" scheme and the specified host and portRequest
newRequest(java.net.URI uri)
Deprecated.Creates a new request with the specified absolute URI.static int
normalizePort(java.lang.String scheme, int port)
Deprecated.Request
POST(java.lang.String uri)
Deprecated.Creates a POST request to the specified URI.Request
POST(java.net.URI uri)
Deprecated.Creates a POST request to the specified URI.HttpDestination
resolveDestination(Origin origin)
Deprecated.Returns, creating it if absent, the destination with the given origin.void
setAddressResolutionTimeout(long addressResolutionTimeout)
Deprecated.Sets the socket address resolution timeout used by the defaultSocketAddressResolver
created by thisHttpClient
at startup.void
setAuthenticationStore(AuthenticationStore authenticationStore)
Deprecated.void
setBindAddress(java.net.SocketAddress bindAddress)
Deprecated.void
setByteBufferPool(ByteBufferPool byteBufferPool)
Deprecated.void
setConnectBlocking(boolean connectBlocking)
Deprecated.Whetherconnect()
operations are performed in blocking mode.void
setConnectTimeout(long connectTimeout)
Deprecated.void
setCookieStore(java.net.CookieStore cookieStore)
Deprecated.void
setDefaultRequestContentType(java.lang.String contentType)
Deprecated.void
setDispatchIO(boolean dispatchIO)
Deprecated.void
setExecutor(java.util.concurrent.Executor executor)
Deprecated.void
setFollowRedirects(boolean follow)
Deprecated.void
setHttpCompliance(HttpCompliance httpCompliance)
Deprecated.Sets the http compliance mode for parsing http responses.void
setIdleTimeout(long idleTimeout)
Deprecated.void
setMaxConnectionsPerDestination(int maxConnectionsPerDestination)
Deprecated.Sets the max number of connections to open to each destinations.void
setMaxRedirects(int maxRedirects)
Deprecated.void
setMaxRequestsQueuedPerDestination(int maxRequestsQueuedPerDestination)
Deprecated.Sets the max number of requests that may be queued to a destination.void
setName(java.lang.String name)
Deprecated.Sets the name of this HttpClient.void
setRemoveIdleDestinations(boolean removeIdleDestinations)
Deprecated.Whether destinations that have no connections (nor active nor idle) should be removed.void
setRequestBufferSize(int requestBufferSize)
Deprecated.void
setResponseBufferSize(int responseBufferSize)
Deprecated.void
setScheduler(Scheduler scheduler)
Deprecated.void
setSocketAddressResolver(SocketAddressResolver resolver)
Deprecated.void
setStrictEventOrdering(boolean strictEventOrdering)
Deprecated.Whether request/response events must be strictly ordered with respect to connection usage.void
setTCPNoDelay(boolean tcpNoDelay)
Deprecated.void
setUserAgentField(HttpField agent)
Deprecated.-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
-
-
-
Constructor Detail
-
HttpClient
public HttpClient()
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS destinations only (that is, requests with the "http" scheme only, and not "https").- See Also:
to perform requests to TLS destinations.
-
HttpClient
public HttpClient(SslContextFactory sslContextFactory)
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS and TLS destinations (that is, both requests with the "http" scheme and with the "https" scheme).- Parameters:
sslContextFactory
- theSslContextFactory
that manages TLS encryption- See Also:
getSslContextFactory()
-
HttpClient
public HttpClient(HttpClientTransport transport)
Deprecated.Creates aHttpClient
instance that can perform requests to non-TLS destinations only (that is, requests with the "http" scheme only, and not "https").- Parameters:
transport
- theHttpClientTransport
- See Also:
to perform requests to TLS destinations.
-
HttpClient
public HttpClient(HttpClientTransport transport, SslContextFactory sslContextFactory)
Deprecated.
-
-
Method Detail
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Deprecated.Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Overrides:
dump
in classContainerLifeCycle
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
java.io.IOException
- if unable to write to Appendable
-
getTransport
public HttpClientTransport getTransport()
Deprecated.
-
getSslContextFactory
public SslContextFactory getSslContextFactory()
Deprecated.- Returns:
- the
SslContextFactory
that manages TLS encryption - See Also:
HttpClient(SslContextFactory)
-
getRequestListeners
public java.util.List<Request.Listener> getRequestListeners()
Deprecated.Returns a non thread-safe list ofRequest.Listener
s that can be modified before performing requests.- Returns:
- a list of
Request.Listener
that can be used to add and remove listeners
-
getCookieStore
public java.net.CookieStore getCookieStore()
Deprecated.- Returns:
- the cookie store associated with this instance
-
setCookieStore
public void setCookieStore(java.net.CookieStore cookieStore)
Deprecated.- Parameters:
cookieStore
- the cookie store associated with this instance
-
getAuthenticationStore
public AuthenticationStore getAuthenticationStore()
Deprecated.- Returns:
- the authentication store associated with this instance
-
setAuthenticationStore
public void setAuthenticationStore(AuthenticationStore authenticationStore)
Deprecated.- Parameters:
authenticationStore
- the authentication store associated with this instance
-
getContentDecoderFactories
public java.util.Set<ContentDecoder.Factory> getContentDecoderFactories()
Deprecated.Returns a non thread-safe set ofContentDecoder.Factory
s that can be modified before performing requests.- Returns:
- a set of
ContentDecoder.Factory
that can be used to add and remove content decoder factories
-
GET
public ContentResponse GET(java.lang.String uri) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
Deprecated.Performs a GET request to the specified URI.- Parameters:
uri
- the URI to GET- Returns:
- the
ContentResponse
for the request - Throws:
java.lang.InterruptedException
- if send threading has been interruptedjava.util.concurrent.ExecutionException
- the execution failedjava.util.concurrent.TimeoutException
- the send timed out- See Also:
GET(URI)
-
GET
public ContentResponse GET(java.net.URI uri) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
Deprecated.Performs a GET request to the specified URI.- Parameters:
uri
- the URI to GET- Returns:
- the
ContentResponse
for the request - Throws:
java.lang.InterruptedException
- if send threading has been interruptedjava.util.concurrent.ExecutionException
- the execution failedjava.util.concurrent.TimeoutException
- the send timed out- See Also:
newRequest(URI)
-
FORM
public ContentResponse FORM(java.lang.String uri, Fields fields) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
Deprecated.Performs a POST request to the specified URI with the given form parameters.- Parameters:
uri
- the URI to POSTfields
- the fields composing the form name/value pairs- Returns:
- the
ContentResponse
for the request - Throws:
java.lang.InterruptedException
- if send threading has been interruptedjava.util.concurrent.ExecutionException
- the execution failedjava.util.concurrent.TimeoutException
- the send timed out
-
FORM
public ContentResponse FORM(java.net.URI uri, Fields fields) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
Deprecated.Performs a POST request to the specified URI with the given form parameters.- Parameters:
uri
- the URI to POSTfields
- the fields composing the form name/value pairs- Returns:
- the
ContentResponse
for the request - Throws:
java.lang.InterruptedException
- if send threading has been interruptedjava.util.concurrent.ExecutionException
- the execution failedjava.util.concurrent.TimeoutException
- the send timed out
-
POST
public Request POST(java.lang.String uri)
Deprecated.Creates a POST request to the specified URI.- Parameters:
uri
- the URI to POST to- Returns:
- the POST request
- See Also:
POST(URI)
-
POST
public Request POST(java.net.URI uri)
Deprecated.Creates a POST request to the specified URI.- Parameters:
uri
- the URI to POST to- Returns:
- the POST request
-
newRequest
public Request newRequest(java.lang.String host, int port)
Deprecated.Creates a new request with the "http" scheme and the specified host and port- Parameters:
host
- the request hostport
- the request port- Returns:
- the request just created
-
newRequest
public Request newRequest(java.lang.String uri)
Deprecated.Creates a new request with the specified absolute URI in string format.- Parameters:
uri
- the request absolute URI- Returns:
- the request just created
-
newRequest
public Request newRequest(java.net.URI uri)
Deprecated.Creates a new request with the specified absolute URI.- Parameters:
uri
- the request absolute URI- Returns:
- the request just created
-
getDestination
public Destination getDestination(java.lang.String scheme, java.lang.String host, int port)
Deprecated.Returns aDestination
for the given scheme, host and port. Applications may useDestination
s to createConnection
s that will be outsideHttpClient
's pooling mechanism, to explicitly control the connection lifecycle (in particular their termination withConnection.close()
).- Parameters:
scheme
- the destination schemehost
- the destination hostport
- the destination port- Returns:
- the destination
- See Also:
getDestinations()
-
resolveDestination
public HttpDestination resolveDestination(Origin origin)
Deprecated.Returns, creating it if absent, the destination with the given origin.
- Parameters:
origin
- the origin that identifies the destination- Returns:
- the destination for the given origin
-
getDestinations
public java.util.List<Destination> getDestinations()
Deprecated.- Returns:
- the list of destinations known to this
HttpClient
.
-
getProtocolHandlers
public ProtocolHandlers getProtocolHandlers()
Deprecated.
-
getByteBufferPool
public ByteBufferPool getByteBufferPool()
Deprecated.- Returns:
- the
ByteBufferPool
of thisHttpClient
-
setByteBufferPool
public void setByteBufferPool(ByteBufferPool byteBufferPool)
Deprecated.- Parameters:
byteBufferPool
- theByteBufferPool
of thisHttpClient
-
getName
@ManagedAttribute("The name of this HttpClient") public java.lang.String getName()
Deprecated.- Returns:
- the name of this HttpClient
-
setName
public void setName(java.lang.String name)
Deprecated.Sets the name of this HttpClient.
The name is also used to generate the JMX ObjectName of this HttpClient and must be set before the registration of the HttpClient MBean in the MBeanServer.
- Parameters:
name
- the name of this HttpClient
-
getConnectTimeout
@ManagedAttribute("The timeout, in milliseconds, for connect() operations") public long getConnectTimeout()
Deprecated.- Returns:
- the max time, in milliseconds, a connection can take to connect to destinations. Zero value means infinite timeout.
-
setConnectTimeout
public void setConnectTimeout(long connectTimeout)
Deprecated.- Parameters:
connectTimeout
- the max time, in milliseconds, a connection can take to connect to destinations. Zero value means infinite timeout.- See Also:
Socket.connect(SocketAddress, int)
-
getAddressResolutionTimeout
public long getAddressResolutionTimeout()
Deprecated.- Returns:
- the timeout, in milliseconds, for the default
SocketAddressResolver
created at startup - See Also:
getSocketAddressResolver()
-
setAddressResolutionTimeout
public void setAddressResolutionTimeout(long addressResolutionTimeout)
Deprecated.Sets the socket address resolution timeout used by the default
SocketAddressResolver
created by thisHttpClient
at startup.For more fine tuned configuration of socket address resolution, see
setSocketAddressResolver(SocketAddressResolver)
.- Parameters:
addressResolutionTimeout
- the timeout, in milliseconds, for the defaultSocketAddressResolver
created at startup- See Also:
setSocketAddressResolver(SocketAddressResolver)
-
getIdleTimeout
@ManagedAttribute("The timeout, in milliseconds, to close idle connections") public long getIdleTimeout()
Deprecated.- Returns:
- the max time, in milliseconds, a connection can be idle (that is, without traffic of bytes in either direction)
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout)
Deprecated.- Parameters:
idleTimeout
- the max time, in milliseconds, a connection can be idle (that is, without traffic of bytes in either direction)
-
getBindAddress
public java.net.SocketAddress getBindAddress()
Deprecated.- Returns:
- the address to bind socket channels to
- See Also:
setBindAddress(SocketAddress)
-
setBindAddress
public void setBindAddress(java.net.SocketAddress bindAddress)
Deprecated.- Parameters:
bindAddress
- the address to bind socket channels to- See Also:
getBindAddress()
,SocketChannel.bind(SocketAddress)
-
getUserAgentField
public HttpField getUserAgentField()
Deprecated.- Returns:
- the "User-Agent" HTTP field of this
HttpClient
-
setUserAgentField
public void setUserAgentField(HttpField agent)
Deprecated.- Parameters:
agent
- the "User-Agent" HTTP header string of thisHttpClient
-
isFollowRedirects
@ManagedAttribute("Whether HTTP redirects are followed") public boolean isFollowRedirects()
Deprecated.- Returns:
- whether this
HttpClient
follows HTTP redirects - See Also:
Request.isFollowRedirects()
-
setFollowRedirects
public void setFollowRedirects(boolean follow)
Deprecated.- Parameters:
follow
- whether thisHttpClient
follows HTTP redirects- See Also:
setMaxRedirects(int)
-
getExecutor
public java.util.concurrent.Executor getExecutor()
Deprecated.- Returns:
- the
Executor
of thisHttpClient
-
setExecutor
public void setExecutor(java.util.concurrent.Executor executor)
Deprecated.- Parameters:
executor
- theExecutor
of thisHttpClient
-
getScheduler
public Scheduler getScheduler()
Deprecated.- Returns:
- the
Scheduler
of thisHttpClient
-
setScheduler
public void setScheduler(Scheduler scheduler)
Deprecated.- Parameters:
scheduler
- theScheduler
of thisHttpClient
-
getSocketAddressResolver
public SocketAddressResolver getSocketAddressResolver()
Deprecated.- Returns:
- the
SocketAddressResolver
of thisHttpClient
-
setSocketAddressResolver
public void setSocketAddressResolver(SocketAddressResolver resolver)
Deprecated.- Parameters:
resolver
- theSocketAddressResolver
of thisHttpClient
-
getMaxConnectionsPerDestination
@ManagedAttribute("The max number of connections per each destination") public int getMaxConnectionsPerDestination()
Deprecated.- Returns:
- the max number of connections that this
HttpClient
opens toDestination
s
-
setMaxConnectionsPerDestination
public void setMaxConnectionsPerDestination(int maxConnectionsPerDestination)
Deprecated.Sets the max number of connections to open to each destinations.RFC 2616 suggests that 2 connections should be opened per each destination, but browsers commonly open 6. If this
HttpClient
is used for load testing, it is common to have only one destination (the server to load test), and it is recommended to set this value to a high value (at least as much as the threads present in theexecutor
).- Parameters:
maxConnectionsPerDestination
- the max number of connections that thisHttpClient
opens toDestination
s
-
getMaxRequestsQueuedPerDestination
@ManagedAttribute("The max number of requests queued per each destination") public int getMaxRequestsQueuedPerDestination()
Deprecated.- Returns:
- the max number of requests that may be queued to a
Destination
.
-
setMaxRequestsQueuedPerDestination
public void setMaxRequestsQueuedPerDestination(int maxRequestsQueuedPerDestination)
Deprecated.Sets the max number of requests that may be queued to a destination.If this
HttpClient
performs a high rate of requests to a destination, and all the connections managed by that destination are busy with other requests, then new requests will be queued up in the destination. This parameter controls how many requests can be queued before starting to reject them. If thisHttpClient
is used for load testing, it is common to have this parameter set to a high value, although this may impact latency (requests sit in the queue for a long time before being sent).- Parameters:
maxRequestsQueuedPerDestination
- the max number of requests that may be queued to aDestination
.
-
getRequestBufferSize
@ManagedAttribute("The request buffer size") public int getRequestBufferSize()
Deprecated.- Returns:
- the size of the buffer used to write requests
-
setRequestBufferSize
public void setRequestBufferSize(int requestBufferSize)
Deprecated.- Parameters:
requestBufferSize
- the size of the buffer used to write requests
-
getResponseBufferSize
@ManagedAttribute("The response buffer size") public int getResponseBufferSize()
Deprecated.- Returns:
- the size of the buffer used to read responses
-
setResponseBufferSize
public void setResponseBufferSize(int responseBufferSize)
Deprecated.- Parameters:
responseBufferSize
- the size of the buffer used to read responses
-
getMaxRedirects
public int getMaxRedirects()
Deprecated.- Returns:
- the max number of HTTP redirects that are followed in a conversation
- See Also:
setMaxRedirects(int)
-
setMaxRedirects
public void setMaxRedirects(int maxRedirects)
Deprecated.- Parameters:
maxRedirects
- the max number of HTTP redirects that are followed in a conversation, or -1 for unlimited redirects- See Also:
setFollowRedirects(boolean)
-
isTCPNoDelay
@ManagedAttribute(value="Whether the TCP_NODELAY option is enabled", name="tcpNoDelay") public boolean isTCPNoDelay()
Deprecated.- Returns:
- whether TCP_NODELAY is enabled
-
setTCPNoDelay
public void setTCPNoDelay(boolean tcpNoDelay)
Deprecated.- Parameters:
tcpNoDelay
- whether TCP_NODELAY is enabled- See Also:
Socket.setTcpNoDelay(boolean)
-
isDispatchIO
@Deprecated public boolean isDispatchIO()
Deprecated.- Returns:
- true to dispatch I/O operations in a different thread, false to execute them in the selector thread
- See Also:
setDispatchIO(boolean)
-
setDispatchIO
@Deprecated public void setDispatchIO(boolean dispatchIO)
Deprecated.Whether to dispatch I/O operations from the selector thread to a different thread.This implementation never blocks on I/O operation, but invokes application callbacks that may take time to execute or block on other I/O. If application callbacks are known to take time or block on I/O, then parameter
dispatchIO
should be set to true. If application callbacks are known to be quick and never block on I/O, then parameterdispatchIO
may be set to false.- Parameters:
dispatchIO
- true to dispatch I/O operations in a different thread, false to execute them in the selector thread
-
getHttpCompliance
public HttpCompliance getHttpCompliance()
Deprecated.Gets the http compliance mode for parsing http responses. The default http compliance level isHttpCompliance.RFC7230
which is the latest HTTP/1.1 specification- Returns:
- the HttpCompliance instance
-
setHttpCompliance
public void setHttpCompliance(HttpCompliance httpCompliance)
Deprecated.Sets the http compliance mode for parsing http responses. This affect how weak theHttpParser
parses http responses and which http protocol level is supported- Parameters:
httpCompliance
- The compliance level which is used to actually parse http responses
-
isStrictEventOrdering
@ManagedAttribute("Whether request/response events must be strictly ordered") public boolean isStrictEventOrdering()
Deprecated.- Returns:
- whether request events must be strictly ordered
- See Also:
setStrictEventOrdering(boolean)
-
setStrictEventOrdering
public void setStrictEventOrdering(boolean strictEventOrdering)
Deprecated.Whether request/response events must be strictly ordered with respect to connection usage.From the point of view of connection usage, the connection can be reused just before the "complete" event notified to
Response.CompleteListener
s (but after the "success" event).When a request/response exchange is completing, the destination may have another request queued to be sent to the server. If the connection for that destination is reused for the second request before the "complete" event of the first exchange, it may happen that the "begin" event of the second request happens before the "complete" event of the first exchange.
Enforcing strict ordering of events so that a "begin" event of a request can never happen before the "complete" event of the previous exchange comes with the cost of increased connection usage. In case of HTTP redirects and strict event ordering, for example, the redirect request will be forced to open a new connection because it is typically sent from the complete listener when the connection cannot yet be reused. When strict event ordering is not enforced, the redirect request will reuse the already open connection making the system more efficient.
The default value for this property is
false
.- Parameters:
strictEventOrdering
- whether request/response events must be strictly ordered
-
isRemoveIdleDestinations
@ManagedAttribute("Whether idle destinations are removed") public boolean isRemoveIdleDestinations()
Deprecated.- Returns:
- whether destinations that have no connections should be removed
- See Also:
setRemoveIdleDestinations(boolean)
-
setRemoveIdleDestinations
public void setRemoveIdleDestinations(boolean removeIdleDestinations)
Deprecated.Whether destinations that have no connections (nor active nor idle) should be removed.Applications typically make request to a limited number of destinations so keeping destinations around is not a problem for the memory or the GC. However, for applications that hit millions of different destinations (e.g. a spider bot) it would be useful to be able to remove the old destinations that won't be visited anymore and leave space for new destinations.
- Parameters:
removeIdleDestinations
- whether destinations that have no connections should be removed- See Also:
DuplexConnectionPool
-
isConnectBlocking
@ManagedAttribute("Whether the connect() operation is blocking") public boolean isConnectBlocking()
Deprecated.- Returns:
- whether
connect()
operations are performed in blocking mode
-
setConnectBlocking
public void setConnectBlocking(boolean connectBlocking)
Deprecated.Whether
connect()
operations are performed in blocking mode.If
connect()
are performed in blocking mode, thenSocket.connect(SocketAddress, int)
will be used to connect to servers.Otherwise,
SocketChannel.connect(SocketAddress)
will be used in non-blocking mode, therefore registering forSelectionKey.OP_CONNECT
and finishing the connect operation when the NIO system emits that event.- Parameters:
connectBlocking
- whetherconnect()
operations are performed in blocking mode
-
getDefaultRequestContentType
@ManagedAttribute("The default content type for request content") public java.lang.String getDefaultRequestContentType()
Deprecated.- Returns:
- the default content type for request content
-
setDefaultRequestContentType
public void setDefaultRequestContentType(java.lang.String contentType)
Deprecated.- Parameters:
contentType
- the default content type for request content
-
getProxyConfiguration
public ProxyConfiguration getProxyConfiguration()
Deprecated.- Returns:
- the forward proxy configuration
-
normalizePort
public static int normalizePort(java.lang.String scheme, int port)
Deprecated.
-
isDefaultPort
public boolean isDefaultPort(java.lang.String scheme, int port)
Deprecated.
-
-