|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mortbay.http.handler.AbstractHttpHandler
org.openqa.selenium.server.ProxyHandler
public class ProxyHandler
Proxy request handler. A HTTP/1.1 Proxy. This implementation uses the JVMs URL implementation to make proxy requests.
The HttpTunnel mechanism is also used to implement the CONNECT method.
Field Summary | |
---|---|
protected java.util.HashSet<java.lang.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 java.util.Set<java.lang.String> |
_proxyHostsBlackList
|
protected java.util.Set<java.lang.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 Summary | |
---|---|
ProxyHandler()
|
Method Summary | |
---|---|
protected void |
customizeConnection(java.lang.String pathInContext,
java.lang.String pathParams,
org.mortbay.http.HttpRequest request,
java.net.Socket socket)
Customize proxy Socket connection for CONNECT. |
protected void |
customizeConnection(java.lang.String pathInContext,
java.lang.String pathParams,
org.mortbay.http.HttpRequest request,
java.net.URLConnection connection)
Customize proxy URL connection. |
void |
generateSSLCertsForLoggingHosts(org.mortbay.http.HttpServer server)
|
java.lang.String[] |
getProxyHostsBlackList()
Get proxy host black list. |
java.lang.String[] |
getProxyHostsWhiteList()
Get proxy host white list. |
int |
getTunnelTimeoutMs()
|
void |
handle(java.lang.String pathInContext,
java.lang.String pathParams,
org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response)
|
void |
handleConnect(java.lang.String pathInContext,
java.lang.String pathParams,
org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response)
|
boolean |
isAnonymous()
|
protected boolean |
isForbidden(java.lang.String scheme,
java.lang.String host,
int port,
boolean openNonPrivPorts)
Is scheme,host & port Forbidden. |
protected boolean |
isForbidden(org.mortbay.util.URI uri)
Is URL Forbidden. |
protected java.net.URL |
isProxied(org.mortbay.util.URI uri)
Is URL Proxied. |
protected boolean |
isProxyInjectionMode()
A special subclass to determine if this proxy should inject Selenium Core's JS in to the appropriate pages. |
static void |
main(java.lang.String[] args)
|
protected org.mortbay.http.HttpTunnel |
newHttpTunnel(org.mortbay.http.HttpRequest request,
org.mortbay.http.HttpResponse response,
java.net.InetAddress iaddr,
int port,
int timeoutMS)
|
protected long |
proxyPlainTextRequest(java.net.URL url,
java.lang.String pathInContext,
java.lang.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. |
void |
setAnonymous(boolean anonymous)
|
void |
setProxyHostsBlackList(java.lang.String[] hosts)
Set proxy host black list. |
void |
setProxyHostsWhiteList(java.lang.String[] hosts)
Set proxy host white list. |
void |
setSslKeystorePath(java.lang.String sslKeystorePath)
|
void |
setTunnelTimeoutMs(int ms)
Tunnel timeout. |
void |
start()
|
Methods inherited from class org.mortbay.http.handler.AbstractHttpHandler |
---|
getHttpContext, getName, handleTrace, initialize, isStarted, setName, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Set<java.lang.String> _proxyHostsWhiteList
protected java.util.Set<java.lang.String> _proxyHostsBlackList
protected int _tunnelTimeoutMs
protected org.mortbay.util.StringMap _DontProxyHeaders
protected org.mortbay.util.StringMap _ProxyAuthHeaders
protected org.mortbay.util.StringMap _ProxySchemes
protected java.util.HashSet<java.lang.Integer> _allowedConnectPorts
Constructor Detail |
---|
public ProxyHandler()
Method Detail |
---|
public void start() throws java.lang.Exception
start
in interface org.mortbay.util.LifeCycle
start
in class org.mortbay.http.handler.AbstractHttpHandler
java.lang.Exception
public java.lang.String[] getProxyHostsWhiteList()
public void setProxyHostsWhiteList(java.lang.String[] hosts)
hosts
- Array of hostnames and IPs that are proxied, or null if all hosts are proxied.public java.lang.String[] getProxyHostsBlackList()
public void setProxyHostsBlackList(java.lang.String[] hosts)
hosts
- Array of hostnames and IPs that are NOT proxied.public int getTunnelTimeoutMs()
public void setTunnelTimeoutMs(int ms)
public void handle(java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws org.mortbay.http.HttpException, java.io.IOException
org.mortbay.http.HttpException
java.io.IOException
protected long proxyPlainTextRequest(java.net.URL url, java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws java.io.IOException
java.io.IOException
protected boolean isProxyInjectionMode()
SeleniumServer.isProxyInjectionMode()
directly so as to make it possible for subclasses (namely those who use SeleniumServer programatically) to easyily
change the behavior of this important class. It is also nice because this class is probably one of the only instances
out in the open source world right now that can act as a full-fledged HTTP+HTTPS proxy, so with proxy injection
turned off, it can pretty much work as an excellent standalone HTTP proxy.
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public void generateSSLCertsForLoggingHosts(org.mortbay.http.HttpServer server)
public void handleConnect(java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response) throws org.mortbay.http.HttpException, java.io.IOException
org.mortbay.http.HttpException
java.io.IOException
protected org.mortbay.http.HttpTunnel newHttpTunnel(org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse response, java.net.InetAddress iaddr, int port, int timeoutMS) throws java.io.IOException
java.io.IOException
protected void customizeConnection(java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest request, java.net.Socket socket)
protected void customizeConnection(java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest request, java.net.URLConnection connection)
protected java.net.URL isProxied(org.mortbay.util.URI uri) throws java.net.MalformedURLException
uri
- The requested URI, which should include a scheme, host and port.
java.net.MalformedURLException
protected boolean isForbidden(org.mortbay.util.URI uri)
protected boolean isForbidden(java.lang.String scheme, java.lang.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 java.io.IOException
java.io.IOException
public boolean isAnonymous()
public void setAnonymous(boolean anonymous)
anonymous
- The anonymous to set.public void setSslKeystorePath(java.lang.String sslKeystorePath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |