Implements communication via HTTP request and response headers for Wildfire Protocols.

category Zend
package Zend_Wildfire
subpackage Channel
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Controller_Plugin_Abstract

 Methods

Destroys the singleton instance

destroyInstance() : void
Static

Primarily used for testing.

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

dispatchLoopShutdown() : void
inherited_from \Zend_Controller_Plugin_Abstract::dispatchLoopShutdown()

Called before Zend_Controller_Front exits its dispatch loop.

dispatchLoopShutdown() : void
Inherited

Called before Zend_Controller_Front enters its dispatch loop.

dispatchLoopStartup(\Zend_Controller_Request_Abstract $request) : void
Inherited

Parameters

$request

\Zend_Controller_Request_Abstract

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

flush() : boolean

Returns

booleanReturns TRUE if data was flushed

Get or create singleton instance

getInstance(boolean $skipCreate = false) : \Zend_Wildfire_Channel_HttpHeaders
Static

Parameters

$skipCreate

boolean

True if an instance should not be created

Returns

\Zend_Wildfire_Channel_HttpHeaders

Get the instance of a give protocol for this channel

getProtocol(string $uri) : object

Parameters

$uri

string

The URI for the protocol

Returns

objectReturns the protocol instance for the diven URI

Get the request object

getRequest() : \Zend_Controller_Request_Abstract
inherited_from \Zend_Controller_Plugin_Abstract::getRequest()

Exceptions

\Zend_Wildfire_Exception

Returns

\Zend_Controller_Request_Abstract

Get request object

getRequest() : \Zend_Controller_Request_Abstract
Inherited

Returns

\Zend_Controller_Request_Abstract$request

Get the response object

getResponse() : \Zend_Controller_Response_Abstract
inherited_from \Zend_Controller_Plugin_Abstract::getResponse()

Exceptions

\Zend_Wildfire_Exception

Returns

\Zend_Controller_Response_Abstract

Get response object

getResponse() : \Zend_Controller_Response_Abstract
Inherited

Returns

\Zend_Controller_Response_Abstract$response

Initialize singleton instance.

init(string $class = null) : \Zend_Wildfire_Channel_HttpHeaders
Static

Parameters

$class

string

OPTIONAL Subclass of Zend_Wildfire_Channel_HttpHeaders

Exceptions

\Zend_Wildfire_Exception

Returns

\Zend_Wildfire_Channel_HttpHeadersReturns the singleton Zend_Wildfire_Channel_HttpHeaders instance

Determine if channel is ready.

isReady(boolean $forceCheckRequest = false) : boolean

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.

inherited_from \Zend_Wildfire_Channel_Interface::isReady()

Parameters

$forceCheckRequest

boolean

OPTIONAL Set to TRUE if the request must be checked

Returns

booleanReturns TRUE if channel is ready.

Called after an action is dispatched by Zend_Controller_Dispatcher.

postDispatch(\Zend_Controller_Request_Abstract $request) : void
Inherited

This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via setDispatched(false)), a new action may be specified for dispatching.

Parameters

$request

\Zend_Controller_Request_Abstract

Called before an action is dispatched by Zend_Controller_Dispatcher.

preDispatch(\Zend_Controller_Request_Abstract $request) : void
Inherited

This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via setDispatched(false)), the current action may be skipped.

Parameters

$request

\Zend_Controller_Request_Abstract

Called after Zend_Controller_Router exits.

routeShutdown(\Zend_Controller_Request_Abstract $request) : void
Inherited

Called after Zend_Controller_Front exits from the router.

Parameters

$request

\Zend_Controller_Request_Abstract

Called before Zend_Controller_Front begins evaluating the request against its routes.

routeStartup(\Zend_Controller_Request_Abstract $request) : void
Inherited

Parameters

$request

\Zend_Controller_Request_Abstract

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

setControllerPluginStackIndex(integer $index) : integer
Static

Parameters

$index

integer

The index of the plugin in the stack

Returns

integerThe previous index.

Set request object

setRequest(\Zend_Controller_Request_Abstract $request) : \Zend_Controller_Plugin_Abstract
Inherited

Parameters

$request

\Zend_Controller_Request_Abstract

Returns

\Zend_Controller_Plugin_Abstract

Set response object

setResponse(\Zend_Controller_Response_Abstract $response) : \Zend_Controller_Plugin_Abstract
Inherited

Parameters

$response

\Zend_Controller_Response_Abstract

Returns

\Zend_Controller_Plugin_Abstract

Initialize a new protocol

_initProtocol(string $uri) : object

Parameters

$uri

string

The URI for the protocol to be initialized

Exceptions

\Zend_Wildfire_Exception

Returns

objectReturns the new initialized protocol instance

Register this object as a controller plugin.

_registerControllerPlugin() : void

 Properties

 

The index of the plugin in the controller dispatch loop plugin stack

$_controllerPluginStackIndex : integer

Default

999
Static
 

The string to be used to prefix the headers.

$_headerPrefix : string

Default

'X-WF-'
Static
 

Singleton instance

$_instance : \Zend_Wildfire_Channel_HttpHeaders

Default

null
Static
 

The protocol instances for this channel

$_protocols : array

Default

null
 

$_request

$_request : \Zend_Controller_Request_Abstract

Default

 

$_response

$_response : \Zend_Controller_Response_Abstract

Default