Wombat::Connector - internal connector interface
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.
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:
- $container
-
the Wombat::Container used for processing Requests
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:
- $scheme
-
the scheme
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:
- $secure
-
the boolean secure connection flag
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.
the Wombat::Application manpage,
the Wombat::Container manpage,
the Wombat::Engine manpage,
the Wombat::HttpRequest manpage,
the Wombat::HttpResponse manpage,
the Wombat::Request manpage,
the Wombat::Response manpage,
the Wombat::Wrapper manpage
Brian Moseley, bcm@maz.org