Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Wildfire_Channel_HttpHeaders Class Reference

Public Member Functions

 getProtocol ($uri)
 Get the instance of a give protocol for this channel.
 
 flush ()
 Flush all data from all protocols and send all data to response headers.
 
 isReady ($forceCheckRequest=false)
 Determine if channel is ready.
 
 dispatchLoopShutdown ()
 Flush messages to headers as late as possible but before headers have been sent.
 
 getRequest ()
 Get the request object.
 
 getResponse ()
 Get the response object.
 
- Public Member Functions inherited from Zend_Controller_Plugin_Abstract
 setRequest (Zend_Controller_Request_Abstract $request)
 Set request object.
 
 getRequest ()
 Get request object.
 
 setResponse (Zend_Controller_Response_Abstract $response)
 Set response object.
 
 getResponse ()
 Get response object.
 
 routeStartup (Zend_Controller_Request_Abstract $request)
 Called before Zend_Controller_Front begins evaluating the request against its routes.
 
 routeShutdown (Zend_Controller_Request_Abstract $request)
 Called after Zend_Controller_Router exits.
 
 dispatchLoopStartup (Zend_Controller_Request_Abstract $request)
 Called before Zend_Controller_Front enters its dispatch loop.
 
 preDispatch (Zend_Controller_Request_Abstract $request)
 Called before an action is dispatched by Zend_Controller_Dispatcher.
 
 postDispatch (Zend_Controller_Request_Abstract $request)
 Called after an action is dispatched by Zend_Controller_Dispatcher.
 
 dispatchLoopShutdown ()
 Called before Zend_Controller_Front exits its dispatch loop.
 
- Public Member Functions inherited from Zend_Wildfire_Channel_Interface
 isReady ()
 Determine if channel is ready.
 

Static Public Member Functions

static init ($class=null)
 Initialize singleton instance.
 
static getInstance ($skipCreate=false)
 Get or create singleton instance.
 
static destroyInstance ()
 Destroys the singleton instance.
 
static setControllerPluginStackIndex ($index)
 Set the index of the plugin in the controller dispatch loop plugin stack.
 

Protected Member Functions

 _initProtocol ($uri)
 Initialize a new protocol.
 
 _registerControllerPlugin ()
 Register this object as a controller plugin.
 

Protected Attributes

 $_protocols = null
 
- Protected Attributes inherited from Zend_Controller_Plugin_Abstract
 $_request
 
 $_response
 

Static Protected Attributes

static $_headerPrefix = 'X-WF-'
 
static $_instance = null
 
static $_controllerPluginStackIndex = 999
 

Member Function Documentation

_initProtocol (   $uri)
protected

Initialize a new protocol.

Parameters
string$uriThe URI for the protocol to be initialized
Returns
object Returns the new initialized protocol instance
Exceptions
Zend_Wildfire_Exception
_registerControllerPlugin ( )
protected

Register this object as a controller plugin.

Returns
void
static destroyInstance ( )
static

Destroys the singleton instance.

Primarily used for testing.

Returns
void
dispatchLoopShutdown ( )

Flush messages to headers as late as possible but before headers have been sent.

Returns
void
flush ( )

Flush all data from all protocols and send all data to response headers.

Returns
boolean Returns TRUE if data was flushed
static getInstance (   $skipCreate = false)
static

Get or create singleton instance.

Parameters
bool$skipCreateTrue if an instance should not be created
Returns
Zend_Wildfire_Channel_HttpHeaders
getProtocol (   $uri)

Get the instance of a give protocol for this channel.

Parameters
string$uriThe URI for the protocol
Returns
object Returns the protocol instance for the diven URI
getRequest ( )

Get the request object.

Returns
Zend_Controller_Request_Abstract
Exceptions
Zend_Wildfire_Exception
getResponse ( )

Get the response object.

Returns
Zend_Controller_Response_Abstract
Exceptions
Zend_Wildfire_Exception
static init (   $class = null)
static

Initialize singleton instance.

Parameters
string$classOPTIONAL Subclass of Zend_Wildfire_Channel_HttpHeaders
Returns
Zend_Wildfire_Channel_HttpHeaders Returns the singleton Zend_Wildfire_Channel_HttpHeaders instance
Exceptions
Zend_Wildfire_Exception
isReady (   $forceCheckRequest = false)

Determine if channel is ready.

The channel is ready as long as the request and response objects are initialized, can send headers and the FirePHP header exists in the User-Agent.

If the header does not exist in the User-Agent, no appropriate client is making this request and the messages should not be sent.

A timing issue arises when messages are logged before the request/response objects are initialized. In this case we do not yet know if the client will be able to accept the messages. If we consequently indicate that the channel is not ready, these messages will be dropped which is in most cases not the intended behaviour. The intent is to send them at the end of the request when the request/response objects will be available for sure.

If the request/response objects are not yet initialized we assume if messages are logged, the client will be able to receive them. As soon as the request/response objects are availoable and a message is logged this assumption is challenged. If the client cannot accept the messages any further messages are dropped and messages sent prior are kept but discarded when the channel is finally flushed at the end of the request.

When the channel is flushed the $forceCheckRequest option is used to force a check of the request/response objects. This is the last verification to ensure messages are only sent when the client can accept them.

Parameters
boolean$forceCheckRequestOPTIONAL Set to TRUE if the request must be checked
Returns
boolean Returns TRUE if channel is ready.
static setControllerPluginStackIndex (   $index)
static

Set the index of the plugin in the controller dispatch loop plugin stack.

Parameters
integer$indexThe index of the plugin in the stack
Returns
integer The previous index.

Member Data Documentation

$_controllerPluginStackIndex = 999
staticprotected
$_headerPrefix = 'X-WF-'
staticprotected
$_instance = null
staticprotected
$_protocols = null
protected