org.mortbay.http.handler
public class ProxyHandler extends AbstractHttpHandler
The HttpTunnel mechanism is also used to implement the CONNECT method.
Version: $Id: ProxyHandler.java,v 1.34 2005/10/05 13:32:59 gregwilkins Exp $
Field Summary | |
---|---|
protected HashSet | _allowedConnectPorts
Set of allowed CONNECT ports. |
protected StringMap | _DontProxyHeaders
Map of leg by leg headers (not end to end). |
protected Set | _proxyHostsBlackList |
protected Set | _proxyHostsWhiteList |
protected StringMap | _ProxyAuthHeaders
Map of leg by leg headers (not end to end). |
protected StringMap | _ProxySchemes
Map of allows schemes to proxy Should be a set, but more efficient string map is used
instead. |
protected int | _tunnelTimeoutMs |
Method Summary | |
---|---|
protected void | customizeConnection(String pathInContext, String pathParams, HttpRequest request, Socket socket)
Customize proxy Socket connection for CONNECT. |
protected void | customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection)
Customize proxy URL connection. |
String[] | getProxyHostsBlackList()
Get proxy host black list.
|
String[] | getProxyHostsWhiteList()
Get proxy host white list.
|
int | getTunnelTimeoutMs() |
void | handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) |
void | handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) |
boolean | isAnonymous() |
protected boolean | isForbidden(URI uri)
Is URL Forbidden.
|
protected boolean | isForbidden(String scheme, String host, int port, boolean openNonPrivPorts)
Is scheme,host & port Forbidden.
|
protected URL | isProxied(URI uri)
Is URL Proxied. |
protected HttpTunnel | newHttpTunnel(HttpRequest request, HttpResponse response, InetAddress iaddr, int port, int timeoutMS) |
protected void | sendForbid(HttpRequest request, HttpResponse response, URI uri)
Send Forbidden. |
void | setAnonymous(boolean anonymous) |
void | setProxyHostsBlackList(String[] hosts)
Set proxy host black list.
|
void | setProxyHostsWhiteList(String[] hosts)
Set proxy host white list.
|
void | setTunnelTimeoutMs(int ms)
Tunnel timeout. |
void | start() |
Returns: Array of hostnames and IPs that are NOT proxied.
Returns: Array of hostnames and IPs that are proxied, or an empty array if all hosts are proxied.
Returns: Returns the anonymous.
Returns: True if the URL is not forbidden. Calls isForbidden(scheme,host,port,true);
Parameters: scheme A scheme that mast be in the proxySchemes StringMap. host A host that must pass the white and black lists port A port that must in the allowedConnectPorts Set openNonPrivPorts If true ports greater than 1024 are allowed.
Returns: True if the request to the scheme,host and port is not forbidden.
Parameters: uri The requested URI, which should include a scheme, host and port.
Returns: The URL to proxy to, or null if the passed URI should not be proxied. The default implementation returns the passed uri if isForbidden() returns true.
Parameters: anonymous The anonymous to set.
Parameters: hosts Array of hostnames and IPs that are NOT proxied.
Parameters: hosts Array of hostnames and IPs that are proxied, or null if all hosts are proxied.