API Documentation

Wildfire/Channel/HttpHeaders.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Wildfire
subpackage
Channel
version
$Id: HttpHeaders.php 23097 2010-10-12 20:40:19Z cadorn $
Classes
Zend_Wildfire_Channel_HttpHeaders

Description

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 license@zend.com so we can send you a copy immediately.

Zend_Wildfire_Channel_HttpHeaders

Extends from
Zend_Controller_Plugin_Abstract
Implements
Zend_Wildfire_Channel_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Wildfire
subpackage
Channel
Properties
$_headerPrefix
$_instance
$_controllerPluginStackIndex
$_protocols
Methods
init
getInstance
destroyInstance
getProtocol
_initProtocol
flush
setControllerPluginStackIndex
_registerControllerPlugin
isReady
dispatchLoopShutdown
getRequest
getResponse

Description

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

Properties

$_controllerPluginStackIndex

integer $_controllerPluginStackIndex = '999'

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

Details

$_controllerPluginStackIndex
integer
visibility
protected
default
999
final
false
static
true

$_headerPrefix

string $_headerPrefix = 'X-WF-'

The string to be used to prefix the headers.

Details

$_headerPrefix
string
visibility
protected
default
X-WF-
final
false
static
true

$_instance

Zend_Wildfire_Channel_HttpHeaders $_instance = 'null'

Singleton instance

Details

$_instance
Zend_Wildfire_Channel_HttpHeaders
visibility
protected
default
null
final
false
static
true

$_protocols

array $_protocols = 'null'

The protocol instances for this channel

Details

$_protocols
array
visibility
protected
default
null
final
false
static
false

Methods

_initProtocol

_initProtocol( string $uri ) : object

Initialize a new protocol

Arguments
$uri
string
The URI for the protocol to be initialized
Output
object
Returns the new initialized protocol instance
Details
visibility
protected
final
false
static
false
throws

_registerControllerPlugin

_registerControllerPlugin( ) : void

Register this object as a controller plugin.

Details
visibility
protected
final
false
static
false

destroyInstance

destroyInstance( ) : void

Destroys the singleton instance

Primarily used for testing.

Details
visibility
public
final
false
static
true

dispatchLoopShutdown

dispatchLoopShutdown( ) : void

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

Details
visibility
public
final
false
static
false

flush

flush( ) : boolean

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

Output
boolean
Returns TRUE if data was flushed
Details
visibility
public
final
false
static
false

getInstance

getInstance( $skipCreate $skipCreate = false ) : Zend_Wildfire_Channel_HttpHeaders

Get or create singleton instance

Arguments
$skipCreate
$skipCreate
boolean True if an instance should not be created
Details
visibility
public
final
false
static
true

getProtocol

getProtocol( string $uri ) : object

Get the instance of a give protocol for this channel

Arguments
$uri
string
The URI for the protocol
Output
object
Returns the protocol instance for the diven URI
Details
visibility
public
final
false
static
false

getRequest

getRequest( ) : Zend_Controller_Request_Abstract

Get the request object

Details
visibility
public
final
false
static
false
throws

getResponse

getResponse( ) : Zend_Controller_Response_Abstract

Get the response object

Details
visibility
public
final
false
static
false
throws

init

init( string $class = null ) : Zend_Wildfire_Channel_HttpHeaders

Initialize singleton instance.

Arguments
$class
string
OPTIONAL Subclass of Zend_Wildfire_Channel_HttpHeaders
Output
Zend_Wildfire_Channel_HttpHeaders
Returns the singleton Zend_Wildfire_Channel_HttpHeaders instance
Details
visibility
public
final
false
static
true
throws

isReady

isReady( 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.

Arguments
$forceCheckRequest
boolean
OPTIONAL Set to TRUE if the request must be checked
Output
boolean
Returns TRUE if channel is ready.
Details
visibility
public
final
false
static
false

setControllerPluginStackIndex

setControllerPluginStackIndex( integer $index ) : integer

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

Arguments
$index
integer
The index of the plugin in the stack
Output
integer
The previous index.
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.