sunlabs.brazil.proxy

Class ProxyHandler

public class ProxyHandler extends Object implements Handler

Handler for implementing a web proxy. By default, this is a dumb proxy. It can be combined with other handlers to generate side effects, such as content rewriting.

Properties:

useproxy
The name of the SocketFactory class to use for this handler. If additional properties are required to set up the SocketFactory, it should be configured as a handler instead. This is here for convenience only.
auth
The value of the proxy-authenticate header (if any) sent to the upstream proxy
proxyHost
If specified, the name of the upstream proxy
proxyPort
The up stream proxys port, if a proxyHost is specified (defaults to 80)
proxylog
If set all http headers will be logged to the console. This is for debugging.

Version: 2.6

Author: Stephen Uhler

Field Summary
static StringAUTH
Stringauth
The string to send as the value for the "Proxy-Authorization" HTTP header (if needed).
StringproxyHost
The proxy server.
intproxyPort
The proxy server's port.
static StringPROXY_HOST
static StringPROXY_PORT
static StringUSE_PROXY
Method Summary
static StringdumpHeaders(int count, Request request, MimeHeaders headers, boolean sent)
Dump the headers on stderr
booleaninit(Server server, String prefix)
Do one-time setup. get and process the properties file options, and make sure
booleanrespond(Request client)
protected MimeHeadersrewriteHeaders(MimeHeaders responseHeaders)
Allow sub-classes to rewrite any or all of the target headers, if needed.

Field Detail

AUTH

public static final String AUTH

auth

public String auth
The string to send as the value for the "Proxy-Authorization" HTTP header (if needed).

proxyHost

public String proxyHost
The proxy server.

proxyPort

public int proxyPort
The proxy server's port. Default is 80.

PROXY_HOST

public static final String PROXY_HOST

PROXY_PORT

public static final String PROXY_PORT

USE_PROXY

public static final String USE_PROXY

Method Detail

dumpHeaders

public static String dumpHeaders(int count, Request request, MimeHeaders headers, boolean sent)
Dump the headers on stderr

init

public boolean init(Server server, String prefix)
Do one-time setup. get and process the properties file options, and make sure

respond

public boolean respond(Request client)

See Also: Handler

rewriteHeaders

protected MimeHeaders rewriteHeaders(MimeHeaders responseHeaders)
Allow sub-classes to rewrite any or all of the target headers, if needed.