sunlabs.brazil.handler
Class ProxyPropertiesHandler
java.lang.Object
  |
  +--sunlabs.brazil.handler.GenericProxyHandler
        |
        +--sunlabs.brazil.handler.ProxyPropertiesHandler
- All Implemented Interfaces: 
- Handler
- public class ProxyPropertiesHandler- extends GenericProxyHandler- implements Handler
Obtain properties format content from remote websites, and
 add it to the current request properties.
 Many of the handlers 
 are designed to produce side effects, by inserting values into the
 request properties (see PropertiesHandler).
 If they are instead configured to produce the properties
 in java properties format, then this handler
 will read their output, and place the result in the request object on
 their behalf.  This capability allows certain handlers to be run on
 other web sites, yet behave as if they are in the handler chain.
 The following request properties are used:
 
 - type	
-  The document type for files to process as
		     java properties (defaults to text/plain)
 
- prepend	
-  The prefix that should be prepended to each property
		     before it is inserted into the request properties
 
- url	
-  The url that should be used to fetch the remote content.
		     If not specified, the curent url is used instead. 
		     Any ${...} constructs in the url are evaluated at each
		     request.
 
NOTE: This capability should be generalized.
 
 
 
| Method Summary | 
|  boolean | init(Server server,
     String prefix)Initializes the handler.
 | 
|  byte[] | modifyContent(Request request,
              byte[] content)Rewrite the links in an html file so they resolve correctly
 in proxy mode.
 | 
|  boolean | respond(Request request)Responds to an HTTP request.
 | 
 
 
 
ProxyPropertiesHandler
public ProxyPropertiesHandler()
init
public boolean init(Server server,
                    String prefix)
- Description copied from interface: Handler
- Initializes the handler.
 
- 
- Specified by:
- initin interface- Handler
- Overrides:
- initin class- GenericProxyHandler
 
- 
- Parameters:
- server- The HTTP server that created this- Handler.
		Typical- Handlers will use- Server.propsto obtain run-time configuration information.
- prefix- The handlers name.
		The string this- Handlermay prepend to all
		of the keys that it uses to extract configuration information
		from- Server.props.  This is set (by the- Serverand- ChainHandler) to help avoid configuration parameter
		namespace collisions.
- Returns:
- trueif this- Handlerinitialized
		successfully,- falseotherwise.  If- falseis returned, this- Handlershould not be used.
 
respond
public boolean respond(Request request)
                throws IOException
- Description copied from interface: Handler
- Responds to an HTTP request.
 
- 
- Specified by:
- respondin interface- Handler
- Overrides:
- respondin class- GenericProxyHandler
 
- 
- Parameters:
- request- The- Requestobject that represents the HTTP
		request.
- Returns:
- trueif the request was handled.  A request was
		handled if a response was supplied to the client, typically
		by calling- Request.sendResponse()or- Request.sendError.
- Throws:
- IOException- if there was an I/O error while sending the response to
		the client.  Typically, in that case, the- Serverwill (try to) send an error message to the client and then
		close the client's connection.- 
		The - IOExceptionshould not be used to silently
		ignore problems such as being unable to access some
		server-side resource (for example getting a- FileNotFoundExceptiondue to not being able
		to open a file).  In that case, the- Handler's
		duty is to turn that- IOExceptioninto a
		HTTP response indicating, in this case, that a file could
		not be found.
 
 
modifyContent
public byte[] modifyContent(Request request,
                            byte[] content)
- Description copied from class: GenericProxyHandler
- Rewrite the links in an html file so they resolve correctly
 in proxy mode.
 
- 
- Overrides:
- modifyContentin class- GenericProxyHandler
 
- 
- Parameters:
- request- The original request to this "proxy"
- Returns:
- true if the headers and content should be sent to the client, false otherwise
			Modifies "headers" as a side effect