|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AggregateLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandlerContainer
org.eclipse.jetty.server.handler.HandlerWrapper
org.eclipse.jetty.server.handler.ConnectHandler
public class ConnectHandler
Implementation of a tunneling proxy that supports HTTP CONNECT.
To work as CONNECT proxy, objects of this class must be instantiated using the no-arguments constructor, since the remote server information will be present in the CONNECT URI.
| 嵌套类摘要 | |
|---|---|
class |
ConnectHandler.ClientToProxyConnection
|
class |
ConnectHandler.ProxyToServerConnection
|
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口 |
|---|
AbstractLifeCycle.AbstractLifeCycleListener |
| 从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口 |
|---|
LifeCycle.Listener |
| 字段摘要 |
|---|
| 从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段 |
|---|
_handler |
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段 |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| 构造方法摘要 | |
|---|---|
ConnectHandler()
|
|
ConnectHandler(Handler handler)
|
|
ConnectHandler(Handler handler,
String[] white,
String[] black)
|
|
ConnectHandler(String[] white,
String[] black)
|
|
| 方法摘要 | |
|---|---|
void |
addBlack(String entry)
Add a blacklist entry to an existing handler configuration |
void |
addWhite(String entry)
Add a whitelist entry to an existing handler configuration |
protected SocketChannel |
connect(HttpServletRequest request,
String host,
int port)
Establishes a connection to the remote server. |
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. |
void |
dump(Appendable out,
String indent)
|
int |
getConnectTimeout()
|
ThreadPool |
getThreadPool()
|
int |
getWriteTimeout()
|
void |
handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
Handle a request. |
protected boolean |
handleAuthentication(HttpServletRequest request,
HttpServletResponse response,
String address)
Handles the authentication before setting up the tunnel to the remote server. |
protected void |
handleConnect(Request baseRequest,
HttpServletRequest request,
HttpServletResponse response,
String serverAddress)
Handles a CONNECT request. |
protected ConnectHandler.ClientToProxyConnection |
newClientToProxyConnection(ConcurrentMap<String,Object> context,
SocketChannel channel,
EndPoint endPoint,
long timeStamp)
|
protected ConnectHandler.ProxyToServerConnection |
newProxyToServerConnection(ConcurrentMap<String,Object> context,
Buffer buffer)
|
protected void |
prepareContext(HttpServletRequest request,
ConcurrentMap<String,Object> context)
|
protected int |
read(EndPoint endPoint,
Buffer buffer,
ConcurrentMap<String,Object> context)
Reads (with non-blocking semantic) into the given buffer from the given endPoint. |
protected void |
set(String[] entries,
HostMap<String> hostMap)
Helper method to process a list of new entries and replace the content of the specified host map |
void |
setBlack(String[] entries)
Re-initialize the blacklist of existing handler object |
void |
setConnectTimeout(int connectTimeout)
|
void |
setServer(Server server)
|
void |
setThreadPool(ThreadPool threadPool)
|
void |
setWhite(String[] entries)
Re-initialize the whitelist of existing handler object |
void |
setWriteTimeout(int writeTimeout)
|
boolean |
validateDestination(String host)
Check the request hostname against white- and blacklist. |
protected int |
write(EndPoint endPoint,
Buffer buffer,
ConcurrentMap<String,Object> context)
Writes (with blocking semantic) the given buffer of data onto the given endPoint. |
| 从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法 |
|---|
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler |
| 从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法 |
|---|
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
| 从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法 |
|---|
dumpThis, getServer |
| 从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法 |
|---|
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, 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.LifeCycle 继承的方法 |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| 构造方法详细信息 |
|---|
public ConnectHandler()
public ConnectHandler(String[] white,
String[] black)
public ConnectHandler(Handler handler)
public ConnectHandler(Handler handler,
String[] white,
String[] black)
| 方法详细信息 |
|---|
public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout - the timeout, in milliseconds, to connect to the remote serverpublic int getWriteTimeout()
public void setWriteTimeout(int writeTimeout)
writeTimeout - the timeout, in milliseconds, to write data to a peerpublic void setServer(Server server)
Handler 中的 setServerHandlerWrapper 中的 setServerpublic ThreadPool getThreadPool()
public void setThreadPool(ThreadPool threadPool)
threadPool - the thread pool
protected void doStart()
throws Exception
AggregateLifeCycle 复制的描述
HandlerWrapper 中的 doStartExceptionAbstractLifeCycle.doStart()
protected void doStop()
throws Exception
AggregateLifeCycle 复制的描述
HandlerWrapper 中的 doStopExceptionAbstractLifeCycle.doStart()
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
Handler 复制的描述
Handler 中的 handleHandlerWrapper 中的 handletarget - The target of the request - either a URI or a name.baseRequest - The original unwrapped request object.request - The request either as the Request
object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection()
method can be used access the Request object if required.response - The response as the Response
object or a wrapper of that request. The AbstractHttpConnection.getCurrentConnection()
method can be used access the Response object if required.
ServletException
IOException
protected void handleConnect(Request baseRequest,
HttpServletRequest request,
HttpServletResponse response,
String serverAddress)
throws ServletException,
IOException
Handles a CONNECT request.
CONNECT requests may have authentication headers such as Proxy-Authorization
that authenticate the client with the proxy.
baseRequest - Jetty-specific http requestrequest - the http requestresponse - the http responseserverAddress - the remote server address in the form host:port
ServletException - if an application error occurs
IOException - if an I/O error occurs
protected boolean handleAuthentication(HttpServletRequest request,
HttpServletResponse response,
String address)
throws ServletException,
IOException
Handles the authentication before setting up the tunnel to the remote server.
The default implementation returns true.
request - the HTTP requestresponse - the HTTP responseaddress - the address of the remote server in the form host:port.
ServletException - to report a server error to the caller
IOException - to report a server error to the caller
protected ConnectHandler.ClientToProxyConnection newClientToProxyConnection(ConcurrentMap<String,Object> context,
SocketChannel channel,
EndPoint endPoint,
long timeStamp)
protected ConnectHandler.ProxyToServerConnection newProxyToServerConnection(ConcurrentMap<String,Object> context,
Buffer buffer)
protected SocketChannel connect(HttpServletRequest request,
String host,
int port)
throws IOException
Establishes a connection to the remote server.
request - the HTTP request that initiated the tunnelhost - the host to connect toport - the port to connect to
SocketChannel connected to the remote server
IOException - if the connection cannot be established
protected void prepareContext(HttpServletRequest request,
ConcurrentMap<String,Object> context)
protected int read(EndPoint endPoint,
Buffer buffer,
ConcurrentMap<String,Object> context)
throws IOException
Reads (with non-blocking semantic) into the given buffer from the given endPoint.
endPoint - the endPoint to read frombuffer - the buffer to read data intocontext - the context information related to the connection
IOException - if the endPoint cannot be read
protected int write(EndPoint endPoint,
Buffer buffer,
ConcurrentMap<String,Object> context)
throws IOException
Writes (with blocking semantic) the given buffer of data onto the given endPoint.
endPoint - the endPoint to write tobuffer - the buffer to writecontext - the context information related to the connection
IOException - if the buffer cannot be writtenpublic void addWhite(String entry)
entry - new whitelist entrypublic void addBlack(String entry)
entry - new blacklist entrypublic void setWhite(String[] entries)
entries - array of whitelist entriespublic void setBlack(String[] entries)
entries - array of blacklist entries
protected void set(String[] entries,
HostMap<String> hostMap)
entries - new entrieshostMap - target host mappublic boolean validateDestination(String host)
host - hostname to check
public void dump(Appendable out,
String indent)
throws IOException
Dumpable 中的 dumpAbstractHandlerContainer 中的 dumpIOException
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||