NAME
Wombat::Connector - internal connector interface
SYNOPSIS
DESCRIPTION
This interface specifies a component that receives requests from and returns responses to a client application. A Connector performs the following general logic:
Receive a request from the client application
Create appropriate Request and Response instances and populate their fields based on the contents of the request.
For all Requests, the connector, handle, protocol, remoteAddr, response, scheme, secure, serverName, and serverPort MUST be set. The contentLength, contentType and socket fields are also generally set.
For HttpRequests, the method, queryString, requestedSessionCookie, requestedSessionId, requestedSessionURL, and requestURI fields MUST be set. Additionally, the various addXXX methods MUST be called to record the presence of cookies, headers and locales in the original request.
For all Responses, the connector, handle and request fields MUST be set.
No additional fields must be set for HttpResponses.
Identify an appropriate Container to use for processing this request. For a standalone Wombat installation, this will probably be a (singleton) Engine. For a Connector attaching Wombat to a web server, this step could take advantage of parsing already performed within the web server to identify the Application, and perhaps even the Wrapper, to utilize in satisfying this Request.
Call
invoke()
on the selected Container, passing the initialized Request and Response instances as arguments.Return any response created by the Container to the client, or return an appropriate error message if an exception of any type was thrown.
ACCESSOR METHODS
- getContainer()
-
Return the Container used for processing Requests received by this Connector.
- setContainer($container)
-
Set the Container used for processing Requests received by this Connector.
Parameters:
- getName()
-
Return the display name of this Connector.
- getScheme()
-
Return the scheme that will be assigned to Requests recieved through this Connector. Default value is http.
- setScheme($scheme)
-
Set the scheme that will be assigned to Requests received through this Connector.
Parameters:
- getSecure()
-
Return the secure connection flag that will be assigned to Requests received through this Connector. Default value is false.
- setSecure($secure)
-
Set the secure connection flag that will be assigned to Requests received through this Connector.
Parameters:
PUBLIC METHODS
- await()
-
Begin listening for requests. Depending upon the implementations, this method may return immediately (for Connectors that execute asynchrously, eg Apache) or may block (eg Http Connector).
- createRequest()
-
Create and return a Request object suitable for specifying the contents of a request to the responsible Container.
- createResponse()
-
Create and return a Response object suitable for receiving the contents of a response from the responsible Container.
SEE ALSO
Wombat::Application, Wombat::Container, Wombat::Engine, Wombat::HttpRequest, Wombat::HttpResponse, Wombat::Request, Wombat::Response, Wombat::Wrapper
AUTHOR
Brian Moseley, bcm@maz.org