|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.http.HttpBuffers
org.eclipse.jetty.client.HttpClient
public class HttpClient
Http Client.
HttpClient is the main active component of the client API implementation. It is the opposite of the Connectors in standard Jetty, in that it listens for responses rather than requests. Just like the connectors, there is a blocking socket version and a non-blocking NIO version (implemented as nested classes selected bysetConnectorType(int)
).
The an instance of HttpExchange
is passed to the send(HttpExchange)
method
to send a request. The exchange contains both the headers and content (source) of the request
plus the callbacks to handle responses. A HttpClient can have many exchanges outstanding
and they may be queued on the HttpDestination
waiting for a AbstractHttpConnection
,
queued in the AbstractHttpConnection
waiting to be transmitted or pipelined on the actual
TCP/IP connection waiting for a response.
The HttpDestination
class is an aggregation of AbstractHttpConnection
s for the
same host, port and protocol. A destination may limit the number of connections
open and they provide a pool of open connections that may be reused. Connections may also
be allocated from a destination, so that multiple request sources are not multiplexed
over the same connection.
HttpExchange
,
HttpDestination
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
org.eclipse.jetty.util.component.LifeCycle.Listener |
Field Summary | |
---|---|
static int |
CONNECTOR_SELECT_CHANNEL
|
static int |
CONNECTOR_SOCKET
|
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
HttpClient()
|
|
HttpClient(org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory)
|
Method Summary | |
---|---|
void |
cancel(org.eclipse.jetty.util.thread.Timeout.Task task)
|
void |
clearAttributes()
|
protected void |
doStart()
|
protected void |
doStop()
|
String |
dump()
|
void |
dump(Appendable out,
String indent)
|
Object |
getAttribute(String name)
|
Enumeration |
getAttributeNames()
|
int |
getConnectorType()
Get the type of connector (socket, blocking or select) in use. |
int |
getConnectTimeout()
|
HttpDestination |
getDestination(Address remote,
boolean ssl)
|
long |
getIdleTimeout()
|
String |
getKeyManagerAlgorithm()
Deprecated. |
InputStream |
getKeyStoreInputStream()
Deprecated. |
String |
getKeyStoreLocation()
Deprecated. |
String |
getKeyStoreType()
Deprecated. |
int |
getMaxConnectionsPerAddress()
|
int |
getMaxQueueSizePerAddress()
|
Set<String> |
getNoProxy()
|
String |
getProtocol()
Deprecated. |
String |
getProvider()
Deprecated. |
Address |
getProxy()
|
Authentication |
getProxyAuthentication()
|
RealmResolver |
getRealmResolver()
returns the SecurityRealmResolver reg_realmResolveristered with the HttpClient or null |
LinkedList<String> |
getRegisteredListeners()
|
String |
getSecureRandomAlgorithm()
Deprecated. |
int |
getSoTimeout()
Deprecated. use getTimeout() instead. |
protected SSLContext |
getSSLContext()
if a keystore location has been provided then client will attempt to use it as the keystore, otherwise we simply ignore certificates and run with a loose ssl context. |
org.eclipse.jetty.util.ssl.SslContextFactory |
getSslContextFactory()
|
org.eclipse.jetty.util.thread.ThreadPool |
getThreadPool()
|
long |
getTimeout()
|
String |
getTrustManagerAlgorithm()
Deprecated. |
InputStream |
getTrustStoreInputStream()
Deprecated. |
String |
getTrustStoreLocation()
Deprecated. |
String |
getTrustStoreType()
Deprecated. |
boolean |
getUseDirectBuffers()
Get whether the connector can use direct NIO buffers. |
boolean |
hasRealms()
|
boolean |
isConnectBlocking()
|
boolean |
isProxied()
|
int |
maxRedirects()
|
int |
maxRetries()
|
void |
registerListener(String listenerClass)
Registers a listener that can listen to the stream of execution between the client and the server and influence events. |
void |
removeAttribute(String name)
|
void |
schedule(org.eclipse.jetty.util.thread.Timeout.Task task)
|
void |
schedule(org.eclipse.jetty.util.thread.Timeout.Task task,
long timeout)
|
void |
scheduleIdle(org.eclipse.jetty.util.thread.Timeout.Task task)
|
void |
send(HttpExchange exchange)
|
void |
setAttribute(String name,
Object attribute)
Set an attribute on the HttpClient. |
void |
setConnectBlocking(boolean connectBlocking)
|
void |
setConnectorType(int connectorType)
|
void |
setConnectTimeout(int connectTimeout)
|
void |
setIdleTimeout(long ms)
|
void |
setKeyManagerAlgorithm(String keyManagerAlgorithm)
Deprecated. |
void |
setKeyManagerPassword(String keyManagerPassword)
Deprecated. |
void |
setKeyStoreInputStream(InputStream keyStoreInputStream)
Deprecated. |
void |
setKeyStoreLocation(String keyStoreLocation)
Deprecated. |
void |
setKeyStorePassword(String keyStorePassword)
Deprecated. |
void |
setKeyStoreType(String keyStoreType)
Deprecated. |
void |
setMaxConnectionsPerAddress(int maxConnectionsPerAddress)
|
void |
setMaxQueueSizePerAddress(int maxQueueSizePerAddress)
|
void |
setMaxRedirects(int redirects)
|
void |
setMaxRetries(int retries)
|
void |
setNoProxy(Set<String> noProxyAddresses)
|
void |
setProtocol(String protocol)
Deprecated. |
void |
setProvider(String provider)
Deprecated. |
void |
setProxy(Address proxy)
|
void |
setProxyAuthentication(Authentication authentication)
|
void |
setRealmResolver(RealmResolver resolver)
Set a RealmResolver for client Authentication. |
void |
setSecureRandomAlgorithm(String secureRandomAlgorithm)
Deprecated. |
void |
setSoTimeout(int timeout)
Deprecated. use setTimeout(long) instead. |
void |
setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
|
void |
setTimeout(long timeout)
|
void |
setTrustManagerAlgorithm(String trustManagerAlgorithm)
Deprecated. |
void |
setTrustStoreInputStream(InputStream trustStoreInputStream)
Deprecated. |
void |
setTrustStoreLocation(String trustStoreLocation)
Deprecated. |
void |
setTrustStorePassword(String trustStorePassword)
Deprecated. |
void |
setTrustStoreType(String trustStoreType)
Deprecated. |
void |
setUseDirectBuffers(boolean direct)
Set to use NIO direct buffers. |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CONNECTOR_SOCKET
public static final int CONNECTOR_SELECT_CHANNEL
Constructor Detail |
---|
public HttpClient()
public HttpClient(org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory)
Method Detail |
---|
public boolean isConnectBlocking()
public void setConnectBlocking(boolean connectBlocking)
connectBlocking
- True if connects will be in blocking mode.public String dump()
dump
in interface org.eclipse.jetty.util.component.Dumpable
Dumpable.dump()
public void dump(Appendable out, String indent) throws IOException
dump
in interface org.eclipse.jetty.util.component.Dumpable
IOException
Dumpable.dump(java.lang.Appendable, java.lang.String)
public void send(HttpExchange exchange) throws IOException
IOException
public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()
public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
threadPool
- the threadPool to setpublic Object getAttribute(String name)
getAttribute
in interface org.eclipse.jetty.util.Attributes
name
-
public Enumeration getAttributeNames()
getAttributeNames
in interface org.eclipse.jetty.util.Attributes
public void removeAttribute(String name)
removeAttribute
in interface org.eclipse.jetty.util.Attributes
name
- public void setAttribute(String name, Object attribute)
setAttribute
in interface org.eclipse.jetty.util.Attributes
name
- attribute
- public void clearAttributes()
clearAttributes
in interface org.eclipse.jetty.util.Attributes
public HttpDestination getDestination(Address remote, boolean ssl) throws IOException
IOException
public void schedule(org.eclipse.jetty.util.thread.Timeout.Task task)
public void schedule(org.eclipse.jetty.util.thread.Timeout.Task task, long timeout)
public void scheduleIdle(org.eclipse.jetty.util.thread.Timeout.Task task)
public void cancel(org.eclipse.jetty.util.thread.Timeout.Task task)
public boolean getUseDirectBuffers()
public void setRealmResolver(RealmResolver resolver)
SecurityListener
so that
BASIC and DIGEST authentication can be performed.
resolver
- public RealmResolver getRealmResolver()
public boolean hasRealms()
public void registerListener(String listenerClass)
listenerClass
- public LinkedList<String> getRegisteredListeners()
public void setUseDirectBuffers(boolean direct)
direct
- If True (the default), the connector can use NIO direct
buffers. Some JVMs have memory management issues (bugs) with
direct buffers.public int getConnectorType()
public void setConnectorType(int connectorType)
public int getMaxConnectionsPerAddress()
public void setMaxConnectionsPerAddress(int maxConnectionsPerAddress)
public int getMaxQueueSizePerAddress()
public void setMaxQueueSizePerAddress(int maxQueueSizePerAddress)
protected void doStart() throws Exception
doStart
in class HttpBuffers
Exception
protected void doStop() throws Exception
doStop
in class HttpBuffers
Exception
protected SSLContext getSSLContext()
public org.eclipse.jetty.util.ssl.SslContextFactory getSslContextFactory()
public long getIdleTimeout()
AbstractHttpConnection
can be idle for before it is closed.public void setIdleTimeout(long ms)
ms
- the period in milliseconds a AbstractHttpConnection
can be idle for before it is closed.@Deprecated public int getSoTimeout()
getTimeout()
instead.
@Deprecated public void setSoTimeout(int timeout)
setTimeout(long)
instead.
timeout
- the period in ms that an exchange will wait for a response from the server.public long getTimeout()
public void setTimeout(long timeout)
timeout
- the period in ms that an exchange will wait for a response from the server.public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout
- the period in ms before timing out an attempt to connectpublic Address getProxy()
public void setProxy(Address proxy)
public Authentication getProxyAuthentication()
public void setProxyAuthentication(Authentication authentication)
public boolean isProxied()
public Set<String> getNoProxy()
public void setNoProxy(Set<String> noProxyAddresses)
public int maxRetries()
public void setMaxRetries(int retries)
public int maxRedirects()
public void setMaxRedirects(int redirects)
@Deprecated public String getTrustStoreLocation()
@Deprecated public void setTrustStoreLocation(String trustStoreLocation)
@Deprecated public InputStream getTrustStoreInputStream()
@Deprecated public void setTrustStoreInputStream(InputStream trustStoreInputStream)
@Deprecated public String getKeyStoreLocation()
@Deprecated public void setKeyStoreLocation(String keyStoreLocation)
@Deprecated public InputStream getKeyStoreInputStream()
@Deprecated public void setKeyStoreInputStream(InputStream keyStoreInputStream)
@Deprecated public void setKeyStorePassword(String keyStorePassword)
@Deprecated public void setKeyManagerPassword(String keyManagerPassword)
@Deprecated public void setTrustStorePassword(String trustStorePassword)
@Deprecated public String getKeyStoreType()
@Deprecated public void setKeyStoreType(String keyStoreType)
@Deprecated public String getTrustStoreType()
@Deprecated public void setTrustStoreType(String trustStoreType)
@Deprecated public String getKeyManagerAlgorithm()
@Deprecated public void setKeyManagerAlgorithm(String keyManagerAlgorithm)
@Deprecated public String getTrustManagerAlgorithm()
@Deprecated public void setTrustManagerAlgorithm(String trustManagerAlgorithm)
@Deprecated public String getProtocol()
@Deprecated public void setProtocol(String protocol)
@Deprecated public String getProvider()
@Deprecated public void setProvider(String provider)
@Deprecated public String getSecureRandomAlgorithm()
@Deprecated public void setSecureRandomAlgorithm(String secureRandomAlgorithm)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |