| sunlabs.brazil.server.Handler
All known Subclasses: sunlabs.brazil.tcl.TclHandler, sunlabs.brazil.template.TemplateHandler, sunlabs.brazil.handler.ResourceHandler, sunlabs.brazil.handler.DynamicConfigHandler, sunlabs.brazil.handler.ReflectHandler, sunlabs.brazil.handler.NotFoundHandler, sunlabs.brazil.handler.ProxyPropertiesHandler, sunlabs.brazil.handler.PushHandler, sunlabs.brazil.handler.GenericProxyHandler, sunlabs.brazil.handler.RestrictClientHandler, sunlabs.brazil.session.PropertiesCacheManager, sunlabs.brazil.handler.SunNetAuthHandler, sunlabs.brazil.server.FileHandler, sunlabs.brazil.handler.PollHandler, sunlabs.brazil.handler.PublishHandler, sunlabs.brazil.handler.LogHandler, sunlabs.brazil.handler.PropertiesHandler, sunlabs.brazil.template.SetTemplate, sunlabs.brazil.proxy.ProxyHandler, sunlabs.brazil.server.ChainHandler, sunlabs.brazil.handler.SMTPHandler, sunlabs.brazil.handler.DirectoryHandler, sunlabs.brazil.handler.ConfigFileHandler, sunlabs.brazil.template.DirectoryTemplate, sunlabs.brazil.handler.UrlMapperHandler, sunlabs.brazil.session.SerialPersist, sunlabs.brazil.session.SerializableCacheManager, sunlabs.brazil.handler.VirtualHostHandler, sunlabs.brazil.handler.SupplyHandler, sunlabs.brazil.proxy.JunkBusterHandler, sunlabs.brazil.handler.BasicAuthHandler, sunlabs.brazil.handler.HomeDirHandler, sunlabs.brazil.handler.AclSwitchHandler, sunlabs.brazil.server.MultiHostHandler, sunlabs.brazil.handler.DialogHandler, sunlabs.brazil.handler.CookieSessionHandler, sunlabs.brazil.handler.ChownHandler, sunlabs.brazil.handler.RolesHandler, sunlabs.brazil.handler.DeferredHandler, sunlabs.brazil.filter.FilterHandler, sunlabs.brazil.handler.CgiHandler, sunlabs.brazil.handler.DefaultFileHandler, sunlabs.brazil.session.CacheManager,
Handler | public interface Handler (Code) | | The interface for writing HTTP handlers. Provides basic functionality
to accept HTTP requests and dispatch to methods to handle the request.
The
Handler.init(Server,String) method is called before this
Handler processes the first HTTP request, to allow it to
prepare itself, such as by allocating any resources needed for the
lifetime of the Handler .
The
Handler.respond(Request) method is called to handle an HTTP request.
This method and all methods it calls must be thread-safe since they may
handle HTTP requests from multiple sockets concurrently. However, each
concurrent request gets its own individual
Request object.
author: Stephen Uhler (stephen.uhler@sun.com) author: Colin Stevens (colin.stevens@sun.com) version: 1.5, 99/11/17 |
Method Summary | |
boolean | init(Server server, String prefix) Initializes the handler.
Parameters: server - The HTTP server that created this Handler .Typical Handler s will use Server.propsto obtain run-time configuration information. Parameters: prefix - A prefix that this Handler may prepend to allof the keys that it uses to extract configuration informationfrom Server.props. | boolean | respond(Request request) Responds to an HTTP request.
Parameters: request - The Request object that represents the HTTPrequest. true if the request was handled. |
init | boolean init(Server server, String prefix)(Code) | | Initializes the handler.
Parameters: server - The HTTP server that created this Handler .Typical Handler s will use Server.propsto obtain run-time configuration information. Parameters: prefix - A prefix that this Handler may prepend to allof the keys that it uses to extract configuration informationfrom Server.props. This is set (by the Serverand ChainHandler) to help avoid configuration parameternamespace collisions.For example, if a Handler uses the property"account", and the specified prefix is "bank.", then theHandler should actually examine the property"bank.account" in Server.props . true if this Handler initializedsuccessfully, false otherwise. Iffalse is returned, this Handler should not be used. |
respond | boolean respond(Request request) throws IOException(Code) | | Responds to an HTTP request.
Parameters: request - The Request object that represents the HTTPrequest. true if the request was handled. A request washandled if a response was supplied to the client, typicallyby calling Request.sendResponse() orRequest.sendError . throws: IOException - if there was an I/O error while sending the response tothe client. Typically, in that case, the Server will (try to) send an error message to the client and thenclose the client's connection.The IOException should not be used to silentlyignore problems such as being unable to access someserver-side resource (for example getting aFileNotFoundException due to not being ableto open a file). In that case, the Handler 'sduty is to turn that IOException into aHTTP response indicating, in this case, that a file couldnot be found. |
|
|