public class ProxyHandler
extends org.mortbay.http.handler.AbstractHttpHandler
Modifier and Type | Field and Description |
---|---|
protected HashSet<Integer> |
_allowedConnectPorts
Set of allowed CONNECT ports.
|
protected org.mortbay.util.StringMap |
_DontProxyHeaders
Map of leg by leg headers (not end to end).
|
protected org.mortbay.util.StringMap |
_ProxyAuthHeaders
Map of leg by leg headers (not end to end).
|
protected Set<String> |
_proxyHostsBlackList |
protected Set<String> |
_proxyHostsWhiteList |
protected org.mortbay.util.StringMap |
_ProxySchemes
Map of allows schemes to proxy Should be a set, but more efficient string map is used
instead.
|
protected int |
_tunnelTimeoutMs |
Constructor and Description |
---|
ProxyHandler(boolean trustAllSSLCertificates,
String dontInjectRegex,
String debugURL,
boolean proxyInjectionMode,
boolean forceProxyChain) |
Modifier and Type | Method and Description |
---|---|
protected void |
customizeConnection(String pathInContext,
String pathParams,
org.mortbay.http.HttpRequest request,
Socket socket)
Customize proxy Socket connection for CONNECT.
|
protected void |
customizeConnection(String pathInContext,
String pathParams,
org.mortbay.http.HttpRequest request,
URLConnection connection)
Customize proxy URL connection.
|
void |
generateSSLCertsForLoggingHosts(org.mortbay.http.HttpServer server) |
String[] |
getProxyHostsBlackList()
Get proxy host black list.
|
String[] |
getProxyHostsWhiteList()
Get proxy host white list.
|
int |
getTunnelTimeoutMs() |
void |
handle(String pathInContext,
String pathParams,
org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response) |
void |
handleConnect(String pathInContext,
String pathParams,
org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response) |
boolean |
isAnonymous() |
protected boolean |
isForbidden(String scheme,
String host,
int port,
boolean openNonPrivPorts)
Is scheme,host & port Forbidden.
|
protected boolean |
isForbidden(org.mortbay.util.URI uri)
Is URL Forbidden.
|
protected URL |
isProxied(org.mortbay.util.URI uri)
Is URL Proxied.
|
static void |
main(String[] args) |
protected org.mortbay.http.HttpTunnel |
newHttpTunnel(org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response,
InetAddress iaddr,
int port,
int timeoutMS) |
protected long |
proxyPlainTextRequest(URL url,
String pathInContext,
String pathParams,
org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response) |
protected void |
sendForbid(org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response,
org.mortbay.util.URI uri)
Send Forbidden.
|
protected void |
sendNotFound(org.mortbay.http.HttpResponse response)
Send not found.
|
void |
setAnonymous(boolean anonymous) |
void |
setProxyHostsBlackList(String[] hosts)
Set proxy host black list.
|
void |
setProxyHostsWhiteList(String[] hosts)
Set proxy host white list.
|
void |
setShutdownLock(Object shutdownLock) |
void |
setSslKeystorePath(String sslKeystorePath) |
void |
setTunnelTimeoutMs(int ms)
Tunnel timeout.
|
boolean |
shouldInject(String path) |
void |
start() |
protected int _tunnelTimeoutMs
protected org.mortbay.util.StringMap _DontProxyHeaders
protected org.mortbay.util.StringMap _ProxyAuthHeaders
protected org.mortbay.util.StringMap _ProxySchemes
public void start() throws Exception
start
in interface org.mortbay.util.LifeCycle
start
in class org.mortbay.http.handler.AbstractHttpHandler
Exception
public String[] getProxyHostsWhiteList()
public void setProxyHostsWhiteList(String[] hosts)
hosts
- Array of hostnames and IPs that are proxied, or null if all hosts are proxied.public String[] getProxyHostsBlackList()
public void setProxyHostsBlackList(String[] hosts)
hosts
- Array of hostnames and IPs that are NOT proxied.public int getTunnelTimeoutMs()
public void setTunnelTimeoutMs(int ms)
public void handle(String pathInContext, String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws org.mortbay.http.HttpException, IOException
org.mortbay.http.HttpException
IOException
protected long proxyPlainTextRequest(URL url, String pathInContext, String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws IOException
IOException
public boolean shouldInject(String path)
public void generateSSLCertsForLoggingHosts(org.mortbay.http.HttpServer server)
public void handleConnect(String pathInContext, String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws org.mortbay.http.HttpException, IOException
org.mortbay.http.HttpException
IOException
protected org.mortbay.http.HttpTunnel newHttpTunnel(org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response, InetAddress iaddr, int port, int timeoutMS) throws IOException
IOException
protected void customizeConnection(String pathInContext, String pathParams, org.mortbay.http.HttpRequest request, Socket socket)
protected void customizeConnection(String pathInContext, String pathParams, org.mortbay.http.HttpRequest request, URLConnection connection)
protected URL isProxied(org.mortbay.util.URI uri) throws MalformedURLException
uri
- The requested URI, which should include a scheme, host and port.MalformedURLException
protected boolean isForbidden(org.mortbay.util.URI uri)
protected boolean isForbidden(String scheme, String host, int port, boolean openNonPrivPorts)
scheme
- A scheme that mast be in the proxySchemes StringMap.host
- A host that must pass the white and black listsport
- A port that must in the allowedConnectPorts SetopenNonPrivPorts
- If true ports greater than 1024 are allowed.protected void sendForbid(org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response, org.mortbay.util.URI uri) throws IOException
IOException
protected void sendNotFound(org.mortbay.http.HttpResponse response) throws IOException
IOException
public boolean isAnonymous()
public void setAnonymous(boolean anonymous)
anonymous
- The anonymous to set.public void setSslKeystorePath(String sslKeystorePath)
public void setShutdownLock(Object shutdownLock)
Copyright © 2012. All Rights Reserved.