Wildfire/Channel/HttpHeaders.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Wildfire  
Subpackage
Channel  
Version
$Id$  

\Zend_Wildfire_Channel_HttpHeaders

Package: Zend_Wildfire\Channel
Implements communication via HTTP request and response headers for Wildfire Protocols.
Implements
Parent(s)
\Zend_Controller_Plugin_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedinteger $_controllerPluginStackIndex = 999
static
The index of the plugin in the controller dispatch loop plugin stack
Default value999Details
Type
integer
>VPropertyprotectedstring $_headerPrefix = 'X-WF-'
static
The string to be used to prefix the headers.
Default value'X-WF-'Details
Type
string
>VPropertyprotected\Zend_Wildfire_Channel_HttpHeaders $_instance = null
static
Singleton instance
Default valuenullDetails
Type
\Zend_Wildfire_Channel_HttpHeaders
>VPropertyprotectedarray $_protocols = null
The protocol instances for this channel
Default valuenullDetails
Type
array

Methods

methodprotected_initProtocol(string $uri) : object

Initialize a new protocol

Parameters
NameTypeDescription
$uristring

The URI for the protocol to be initialized

Returns
TypeDescription
objectReturns the new initialized protocol instance
Throws
ExceptionDescription
\Zend_Wildfire_Exception
methodprotected_registerControllerPlugin() : void

Register this object as a controller plugin.

methodpublicdestroyInstance() : void
static

Destroys the singleton instance

Primarily used for testing.
methodpublicdispatchLoopShutdown() : void

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

methodpublicflush() : boolean

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

Returns
TypeDescription
booleanReturns TRUE if data was flushed
methodpublicgetInstance(bool $skipCreate = false) : \Zend_Wildfire_Channel_HttpHeaders
static

Get or create singleton instance

Parameters
NameTypeDescription
$skipCreatebool

True if an instance should not be created

Returns
TypeDescription
\Zend_Wildfire_Channel_HttpHeaders
methodpublicgetProtocol(string $uri) : object

Get the instance of a give protocol for this channel

Parameters
NameTypeDescription
$uristring

The URI for the protocol

Returns
TypeDescription
objectReturns the protocol instance for the diven URI
methodpublicgetRequest() : \Zend_Controller_Request_Abstract

Get the request object

Returns
TypeDescription
\Zend_Controller_Request_Abstract
Throws
ExceptionDescription
\Zend_Wildfire_Exception
methodpublicgetResponse() : \Zend_Controller_Response_Abstract

Get the response object

Returns
TypeDescription
\Zend_Controller_Response_Abstract
Throws
ExceptionDescription
\Zend_Wildfire_Exception
methodpublicinit(string $class = null) : \Zend_Wildfire_Channel_HttpHeaders
static

Initialize singleton instance.

Parameters
NameTypeDescription
$classstring

OPTIONAL Subclass of Zend_Wildfire_Channel_HttpHeaders

Returns
TypeDescription
\Zend_Wildfire_Channel_HttpHeadersReturns the singleton Zend_Wildfire_Channel_HttpHeaders instance
Throws
ExceptionDescription
\Zend_Wildfire_Exception
methodpublicisReady(boolean $forceCheckRequest = false) : boolean

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
NameTypeDescription
$forceCheckRequestboolean

OPTIONAL Set to TRUE if the request must be checked

Returns
TypeDescription
booleanReturns TRUE if channel is ready.
methodpublicsetControllerPluginStackIndex(integer $index) : integer
static

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

Parameters
NameTypeDescription
$indexinteger

The index of the plugin in the stack

Returns
TypeDescription
integerThe previous index.
Documentation was generated by phpDocumentor 2.2.0 .