Sun and Oracle Community Voices How to Buy Log In United States [Change] English

»  Spotlight Articles
»  Projects
»  Publications
»  People
»  Awards
»  Events
»  Downloads
»  Internships
»  Contrarian Minds
»  About Sun Labs
Brazil project: Class ProxyHandler

sunlabs.brazil.proxy Class ProxyHandler

java.lang.Object
  |
  +--sunlabs.brazil.proxy.ProxyHandler
All Implemented Interfaces:
Handler

public class ProxyHandler
extends Object
implements Handler

Generic Handler for implementing a simple web proxy. By default, this is a dumb proxy. This can be extended to "log" all requests, with possible side effects, and to provide pages on request. The handler is NOT intended to be a general puupose proxy handler (KISS). This should be replaced by a more general purpose http/1.1 proxy This is split up into more pieces than needed, to make it more generically sub-classable, at the expense of more complexity. Properties:

useproxy
The name of the SocketFactory class to use for this handler. If additional parameters are required to set up the factory, it should be configured elsewhere. 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 pecified (defaults to 80)


Field Summary
 String auth           The string to send as the value for the "Proxy-Authorization" HTTP header (if needed).
static String AUTH            
static String PROXY_HOST            
static String PROXY_PORT            
 String proxyHost           The proxy server.
 int proxyPort           The proxy server's port.
static String USE_PROXY            
 
Constructor Summary
ProxyHandler()            
 
Method Summary
 boolean init(Server server, String prefix)           Do one-time setup.
 boolean respond(Request client)           Responds to an HTTP request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_HOST

public static final String PROXY_HOST

PROXY_PORT

public static final String PROXY_PORT

AUTH

public static final String AUTH

USE_PROXY

public static final String USE_PROXY

proxyHost

public String proxyHost
The proxy server.

proxyPort

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

auth

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

ProxyHandler

public ProxyHandler()
Method Detail

init

public boolean init(Server server,
                    String prefix)
Do one-time setup. get and process the properties file options, and make sure
Specified by:
init in interface Handler
Tags copied from interface: Handler
Parameters:
server - The HTTP server that created this Handler. Typical Handlers will use Server.props to obtain run-time configuration information.
prefix - A prefix that this Handler may prepend to all of the keys that it uses to extract configuration information from Server.props. This is set (by the Server and ChainHandler) to help avoid configuration parameter namespace collisions.

For example, if a Handler uses the property "account", and the specified prefix is "bank.", then the Handler should actually examine the property "bank.account" in Server.props.

Returns:
true if this Handler initialized successfully, false otherwise. If false is returned, this Handler should not be used.

respond

public boolean respond(Request client)
                throws IOException
Description copied from interface: Handler
Responds to an HTTP request.
Specified by:
respond in interface Handler
See Also:
Handler.respond(sunlabs.brazil.server.Request)

Version 2.2, Generated 07/25/00
Copyright (c) 2000, Sun Microsystems.