Brian Moseley > Wombat > Wombat::Connector

Download:
Wombat-0.7.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

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:

  1. Receive a request from the client application
  2. Create appropriate Request and Response instances and populate their fields based on the contents of the request.
    1. 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.
    2. 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.
    3. For all Responses, the connector, handle and request fields MUST be set.
    4. No additional fields must be set for HttpResponses.
  3. 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.
  4. Call invoke() on the selected Container, passing the initialized Request and Response instances as arguments.
  5. 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:

$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

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

syntax highlighting: