|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AggregateLifeCycle
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 AbstractHttpConnections 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| 嵌套类摘要 |
|---|
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口 |
|---|
AbstractLifeCycle.AbstractLifeCycleListener |
| 从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口 |
|---|
LifeCycle.Listener |
| 字段摘要 | |
|---|---|
static int |
CONNECTOR_SELECT_CHANNEL
|
static int |
CONNECTOR_SOCKET
|
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段 |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| 构造方法摘要 | |
|---|---|
HttpClient()
|
|
HttpClient(SslContextFactory sslContextFactory)
|
|
| 方法摘要 | |
|---|---|
void |
cancel(Timeout.Task task)
|
void |
clearAttributes()
|
protected void |
doStart()
Start the managed lifecycle beans in the order they were added. |
protected void |
doStop()
Stop the joined lifecycle beans in the reverse order they were added. |
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()
已过时。 |
InputStream |
getKeyStoreInputStream()
已过时。 |
String |
getKeyStoreLocation()
已过时。 |
String |
getKeyStoreType()
已过时。 |
int |
getMaxBuffers()
|
int |
getMaxConnectionsPerAddress()
|
int |
getMaxQueueSizePerAddress()
|
Set<String> |
getNoProxy()
|
String |
getProtocol()
已过时。 |
String |
getProvider()
已过时。 |
Address |
getProxy()
|
Authentication |
getProxyAuthentication()
|
RealmResolver |
getRealmResolver()
returns the SecurityRealmResolver reg_realmResolveristered with the HttpClient or null |
LinkedList<String> |
getRegisteredListeners()
|
Buffers |
getRequestBuffers()
|
int |
getRequestBufferSize()
|
Buffers.Type |
getRequestBufferType()
|
int |
getRequestHeaderSize()
|
Buffers.Type |
getRequestHeaderType()
|
Buffers |
getResponseBuffers()
|
int |
getResponseBufferSize()
|
Buffers.Type |
getResponseBufferType()
|
int |
getResponseHeaderSize()
|
Buffers.Type |
getResponseHeaderType()
|
String |
getSecureRandomAlgorithm()
已过时。 |
int |
getSoTimeout()
已过时。 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. |
SslContextFactory |
getSslContextFactory()
|
ThreadPool |
getThreadPool()
|
long |
getTimeout()
|
String |
getTrustManagerAlgorithm()
已过时。 |
InputStream |
getTrustStoreInputStream()
已过时。 |
String |
getTrustStoreLocation()
已过时。 |
String |
getTrustStoreType()
已过时。 |
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(Timeout.Task task)
|
void |
schedule(Timeout.Task task,
long timeout)
|
void |
scheduleIdle(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)
已过时。 |
void |
setKeyManagerPassword(String keyManagerPassword)
已过时。 |
void |
setKeyStoreInputStream(InputStream keyStoreInputStream)
已过时。 |
void |
setKeyStoreLocation(String keyStoreLocation)
已过时。 |
void |
setKeyStorePassword(String keyStorePassword)
已过时。 |
void |
setKeyStoreType(String keyStoreType)
已过时。 |
void |
setMaxBuffers(int maxBuffers)
|
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)
已过时。 |
void |
setProvider(String provider)
已过时。 |
void |
setProxy(Address proxy)
|
void |
setProxyAuthentication(Authentication authentication)
|
void |
setRealmResolver(RealmResolver resolver)
Set a RealmResolver for client Authentication. |
void |
setRequestBuffers(Buffers requestBuffers)
|
void |
setRequestBufferSize(int requestBufferSize)
|
void |
setRequestHeaderSize(int requestHeaderSize)
|
void |
setResponseBuffers(Buffers responseBuffers)
|
void |
setResponseBufferSize(int responseBufferSize)
|
void |
setResponseHeaderSize(int responseHeaderSize)
|
void |
setSecureRandomAlgorithm(String secureRandomAlgorithm)
已过时。 |
void |
setSoTimeout(int timeout)
已过时。 use setTimeout(long) instead. |
void |
setThreadPool(ThreadPool threadPool)
Set the ThreadPool. |
void |
setTimeout(long timeout)
|
void |
setTrustManagerAlgorithm(String trustManagerAlgorithm)
已过时。 |
void |
setTrustStoreInputStream(InputStream trustStoreInputStream)
已过时。 |
void |
setTrustStoreLocation(String trustStoreLocation)
已过时。 |
void |
setTrustStorePassword(String trustStorePassword)
已过时。 |
void |
setTrustStoreType(String trustStoreType)
已过时。 |
void |
setUseDirectBuffers(boolean direct)
Set to use NIO direct buffers. |
| 从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法 |
|---|
addBean, addBean, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage |
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法 |
|---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 从接口 org.eclipse.jetty.util.component.Dumpable 继承的方法 |
|---|
dump, dump |
| 字段详细信息 |
|---|
public static final int CONNECTOR_SOCKET
public static final int CONNECTOR_SELECT_CHANNEL
| 构造方法详细信息 |
|---|
public HttpClient()
public HttpClient(SslContextFactory sslContextFactory)
| 方法详细信息 |
|---|
public boolean isConnectBlocking()
public void setConnectBlocking(boolean connectBlocking)
connectBlocking - True if connects will be in blocking mode.
public void send(HttpExchange exchange)
throws IOException
IOExceptionpublic ThreadPool getThreadPool()
public void setThreadPool(ThreadPool threadPool)
AggregateLifeCycle.addBean(Object) so that
it's lifecycle may be managed as a AggregateLifeCycle.
threadPool - the threadPool to setpublic Object getAttribute(String name)
Attributes 中的 getAttributename -
public Enumeration getAttributeNames()
Attributes 中的 getAttributeNamespublic void removeAttribute(String name)
Attributes 中的 removeAttributename -
public void setAttribute(String name,
Object attribute)
Attributes 中的 setAttributename - attribute - public void clearAttributes()
Attributes 中的 clearAttributes
public HttpDestination getDestination(Address remote,
boolean ssl)
throws IOException
IOExceptionpublic void schedule(Timeout.Task task)
public void schedule(Timeout.Task task,
long timeout)
public void scheduleIdle(Timeout.Task task)
public void cancel(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
AggregateLifeCycle 复制的描述
AggregateLifeCycle 中的 doStartExceptionAbstractLifeCycle.doStart()
protected void doStop()
throws Exception
AggregateLifeCycle 复制的描述
AggregateLifeCycle 中的 doStopExceptionAbstractLifeCycle.doStart()protected SSLContext getSSLContext()
public 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)
public int getRequestBufferSize()
HttpBuffers 中的 getRequestBufferSizepublic void setRequestBufferSize(int requestBufferSize)
HttpBuffers 中的 setRequestBufferSizerequestBufferSize - the requestBufferSize to setpublic int getRequestHeaderSize()
HttpBuffers 中的 getRequestHeaderSizepublic void setRequestHeaderSize(int requestHeaderSize)
HttpBuffers 中的 setRequestHeaderSizerequestHeaderSize - the requestHeaderSize to setpublic int getResponseBufferSize()
HttpBuffers 中的 getResponseBufferSizepublic void setResponseBufferSize(int responseBufferSize)
HttpBuffers 中的 setResponseBufferSizeresponseBufferSize - the responseBufferSize to setpublic int getResponseHeaderSize()
HttpBuffers 中的 getResponseHeaderSizepublic void setResponseHeaderSize(int responseHeaderSize)
HttpBuffers 中的 setResponseHeaderSizeresponseHeaderSize - the responseHeaderSize to setpublic Buffers.Type getRequestBufferType()
HttpBuffers 中的 getRequestBufferTypepublic Buffers.Type getRequestHeaderType()
HttpBuffers 中的 getRequestHeaderTypepublic Buffers.Type getResponseBufferType()
HttpBuffers 中的 getResponseBufferTypepublic Buffers.Type getResponseHeaderType()
HttpBuffers 中的 getResponseHeaderTypepublic void setRequestBuffers(Buffers requestBuffers)
HttpBuffers 中的 setRequestBuffersrequestBuffers - the requestBuffers to setpublic void setResponseBuffers(Buffers responseBuffers)
HttpBuffers 中的 setResponseBuffersresponseBuffers - the responseBuffers to setpublic Buffers getRequestBuffers()
HttpBuffers 中的 getRequestBufferspublic Buffers getResponseBuffers()
HttpBuffers 中的 getResponseBufferspublic void setMaxBuffers(int maxBuffers)
HttpBuffers 中的 setMaxBufferspublic int getMaxBuffers()
HttpBuffers 中的 getMaxBuffers@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)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||