public class ConnectHandler
extends org.eclipse.jetty.server.handler.HandlerWrapper
Implementation of a Handler that supports HTTP CONNECT.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ConnectHandler.ConnectContext |
protected class |
ConnectHandler.ConnectManager |
class |
ConnectHandler.DownstreamConnection |
class |
ConnectHandler.UpstreamConnection |
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Constructor and Description |
|---|
ConnectHandler() |
ConnectHandler(org.eclipse.jetty.server.Handler handler) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
connectToServer(javax.servlet.http.HttpServletRequest request,
String host,
int port,
Promise<SocketChannel> promise) |
protected void |
doStart() |
void |
dump(Appendable out,
String indent) |
Set<String> |
getBlackListHosts() |
int |
getBufferSize() |
org.eclipse.jetty.io.ByteBufferPool |
getByteBufferPool() |
long |
getConnectTimeout() |
Executor |
getExecutor() |
long |
getIdleTimeout() |
Scheduler |
getScheduler() |
Set<String> |
getWhiteListHosts() |
void |
handle(String target,
org.eclipse.jetty.server.Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected boolean |
handleAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String address)
Handles the authentication before setting up the tunnel to the remote server.
|
protected void |
handleConnect(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String serverAddress)
Handles a CONNECT request.
|
protected InetSocketAddress |
newConnectAddress(String host,
int port)
Creates the server address to connect to.
|
protected ConnectHandler.DownstreamConnection |
newDownstreamConnection(org.eclipse.jetty.io.EndPoint endPoint,
ConcurrentMap<String,Object> context) |
protected ConnectHandler.DownstreamConnection |
newDownstreamConnection(org.eclipse.jetty.io.EndPoint endPoint,
ConcurrentMap<String,Object> context,
ByteBuffer buffer)
Deprecated.
use
newDownstreamConnection(EndPoint, ConcurrentMap) instead |
protected org.eclipse.jetty.io.SelectorManager |
newSelectorManager() |
protected ConnectHandler.UpstreamConnection |
newUpstreamConnection(org.eclipse.jetty.io.EndPoint endPoint,
ConnectHandler.ConnectContext connectContext) |
protected void |
onConnectFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.AsyncContext asyncContext,
Throwable failure) |
protected void |
onConnectSuccess(ConnectHandler.ConnectContext connectContext,
ConnectHandler.UpstreamConnection upstreamConnection) |
protected void |
prepareContext(javax.servlet.http.HttpServletRequest request,
ConcurrentMap<String,Object> context) |
protected int |
read(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer buffer)
Deprecated.
override
read(EndPoint, ByteBuffer, ConcurrentMap) instead |
protected int |
read(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer buffer,
ConcurrentMap<String,Object> context)
Reads (with non-blocking semantic) into the given
buffer from the given endPoint. |
void |
setBufferSize(int bufferSize) |
void |
setByteBufferPool(org.eclipse.jetty.io.ByteBufferPool bufferPool) |
void |
setConnectTimeout(long connectTimeout) |
void |
setExecutor(Executor executor) |
void |
setIdleTimeout(long idleTimeout) |
void |
setScheduler(Scheduler scheduler) |
boolean |
validateDestination(String host,
int port)
Checks the given
host and port against whitelist and blacklist. |
protected void |
write(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer buffer,
Callback callback)
Deprecated.
override
write(EndPoint, ByteBuffer, Callback, ConcurrentMap) instead |
protected void |
write(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer buffer,
Callback callback,
ConcurrentMap<String,Object> context)
Writes (with non-blocking semantic) the given buffer of data onto the given endPoint.
|
destroy, expandChildren, getHandler, getHandlers, setHandler, setServerexpandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassdoStop, dumpThis, getServeraddBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected static final Logger LOG
public ConnectHandler()
public ConnectHandler(org.eclipse.jetty.server.Handler handler)
public Executor getExecutor()
public void setExecutor(Executor executor)
public Scheduler getScheduler()
public void setScheduler(Scheduler scheduler)
public org.eclipse.jetty.io.ByteBufferPool getByteBufferPool()
public void setByteBufferPool(org.eclipse.jetty.io.ByteBufferPool bufferPool)
public long getConnectTimeout()
public void setConnectTimeout(long connectTimeout)
connectTimeout - the timeout, in milliseconds, to connect to the remote serverpublic long getIdleTimeout()
public void setIdleTimeout(long idleTimeout)
idleTimeout - the idle timeout, in millisecondspublic int getBufferSize()
public void setBufferSize(int bufferSize)
protected void doStart()
throws Exception
doStart in class org.eclipse.jetty.server.handler.AbstractHandlerExceptionprotected org.eclipse.jetty.io.SelectorManager newSelectorManager()
public void handle(String target, org.eclipse.jetty.server.Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
handle in interface org.eclipse.jetty.server.Handlerhandle in class org.eclipse.jetty.server.handler.HandlerWrapperjavax.servlet.ServletExceptionIOExceptionprotected void handleConnect(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String serverAddress)
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:portprotected void connectToServer(javax.servlet.http.HttpServletRequest request,
String host,
int port,
Promise<SocketChannel> promise)
protected InetSocketAddress newConnectAddress(String host, int port)
host - The host from the CONNECT requestport - The port from the CONNECT requestprotected void onConnectSuccess(ConnectHandler.ConnectContext connectContext, ConnectHandler.UpstreamConnection upstreamConnection)
protected void onConnectFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.AsyncContext asyncContext,
Throwable failure)
protected boolean handleAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String address)
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.@Deprecated protected ConnectHandler.DownstreamConnection newDownstreamConnection(org.eclipse.jetty.io.EndPoint endPoint, ConcurrentMap<String,Object> context, ByteBuffer buffer)
newDownstreamConnection(EndPoint, ConcurrentMap) insteadprotected ConnectHandler.DownstreamConnection newDownstreamConnection(org.eclipse.jetty.io.EndPoint endPoint, ConcurrentMap<String,Object> context)
protected ConnectHandler.UpstreamConnection newUpstreamConnection(org.eclipse.jetty.io.EndPoint endPoint, ConnectHandler.ConnectContext connectContext)
protected void prepareContext(javax.servlet.http.HttpServletRequest request,
ConcurrentMap<String,Object> context)
protected int read(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer 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 connectionIOException - if the endPoint cannot be read@Deprecated protected int read(org.eclipse.jetty.io.EndPoint endPoint, ByteBuffer buffer) throws IOException
read(EndPoint, ByteBuffer, ConcurrentMap) insteadIOExceptionprotected void write(org.eclipse.jetty.io.EndPoint endPoint,
ByteBuffer buffer,
Callback callback,
ConcurrentMap<String,Object> context)
Writes (with non-blocking semantic) the given buffer of data onto the given endPoint.
endPoint - the endPoint to write tobuffer - the buffer to writecallback - the completion callback to invoke@Deprecated protected void write(org.eclipse.jetty.io.EndPoint endPoint, ByteBuffer buffer, Callback callback)
write(EndPoint, ByteBuffer, Callback, ConcurrentMap) insteadpublic boolean validateDestination(String host, int port)
host and port against whitelist and blacklist.host - the host to checkport - the port to checkpublic void dump(Appendable out, String indent) throws IOException
dump in interface Dumpabledump in class ContainerLifeCycleIOExceptionCopyright © 1995-2019 Webtide. All Rights Reserved.