API Documentation

Controller/Response/Abstract.php

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_Controller
version
$Id: Abstract.php 21302 2010-03-02 23:01:38Z yoshida@zend.co.jp $
Classes
Zend_Controller_Response_Abstract

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_Controller_Response_Abstract

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_Controller
subpackage
Response
Properties
$_body
$_exceptions
$_headers
$_headersRaw
$_httpResponseCode
$_isRedirect
$_renderExceptions
$headersSentThrowsException
Methods
_normalizeHeader
setHeader
setRedirect
isRedirect
getHeaders
clearHeaders
clearHeader
setRawHeader
getRawHeaders
clearRawHeaders
clearRawHeader
clearAllHeaders
setHttpResponseCode
getHttpResponseCode
canSendHeaders
sendHeaders
setBody
appendBody
clearBody
getBody
append
prepend
insert
outputBody
setException
getException
isException
hasExceptionOfType
hasExceptionOfMessage
hasExceptionOfCode
getExceptionByType
getExceptionByMessage
getExceptionByCode
renderExceptions
sendResponse
__toString

Description

Zend_Controller_Response_Abstract

Base class for Zend_Controller responses

Properties

$_body

array $_body = 'array'

Body content

Details

$_body
array
visibility
protected
default
array
final
false
static
false

$_exceptions

Exception $_exceptions = 'array'

Exception stack

Details

$_exceptions
Exception
visibility
protected
default
array
final
false
static
false

$_headers

array $_headers = 'array'

Array of headers. Each header is an array with keys 'name' and 'value'

Details

$_headers
array
visibility
protected
default
array
final
false
static
false

$_headersRaw

array $_headersRaw = 'array'

Array of raw headers. Each header is a single string, the entire header to emit

Details

$_headersRaw
array
visibility
protected
default
array
final
false
static
false

$_httpResponseCode

int $_httpResponseCode = '200'

HTTP response code to use in headers

Details

$_httpResponseCode
int
visibility
protected
default
200
final
false
static
false

$_isRedirect

boolean $_isRedirect = 'false'

Flag; is this response a redirect?

Details

$_isRedirect
boolean
visibility
protected
default
false
final
false
static
false

$_renderExceptions

boolean $_renderExceptions = 'false'

Whether or not to render exceptions; off by default

Details

$_renderExceptions
boolean
visibility
protected
default
false
final
false
static
false

$headersSentThrowsException

boolean $headersSentThrowsException = 'true'

Flag; if true, when header operations are called after headers have been sent, an exception will be raised; otherwise, processing will continue as normal. Defaults to true.

Details

$headersSentThrowsException
boolean
visibility
public
default
true
final
false
static
false
see
canSendHeaders()

Methods

__toString

__toString( ) : string

Magic __toString functionality

Proxies to {@link sendResponse()} and returns response value as string using output buffering.

Output
string
Details
visibility
public
final
false
static
false

_normalizeHeader

_normalizeHeader( string $name ) : string

Normalize a header name

Normalizes a header name to X-Capitalized-Names

Arguments
$name
string
Output
string
Details
visibility
protected
final
false
static
false

append

append( string $name, string $content ) : Zend_Controller_Response_Abstract

Append a named body segment to the body content array

If segment already exists, replaces with $content and places at end of array.

Arguments
$name
string
$content
string
Details
visibility
public
final
false
static
false

appendBody

appendBody( string $content, null|string $name = null ) : Zend_Controller_Response_Abstract

Append content to the body content

Arguments
$content
string
$name
nullstring
Details
visibility
public
final
false
static
false

canSendHeaders

canSendHeaders( boolean $throw = false ) : boolean

Can we send headers?

Arguments
$throw
boolean
Whether or not to throw an exception if headers have been sent; defaults to false
Output
boolean
Details
visibility
public
final
false
static
false
throws

clearAllHeaders

clearAllHeaders( ) : Zend_Controller_Response_Abstract

Clear all headers, normal and raw

Details
visibility
public
final
false
static
false

clearBody

clearBody( string $name = null ) : boolean

Clear body array

With no arguments, clears the entire body array. Given a $name, clears just that named segment; if no segment matching $name exists, returns false to indicate an error.

Arguments
$name
string
Named segment to clear
Output
boolean
Details
visibility
public
final
false
static
false

clearHeader

clearHeader( string $name ) : Zend_Controller_Response_Abstract

Clears the specified HTTP header

Arguments
$name
string
Details
visibility
public
final
false
static
false

clearHeaders

clearHeaders( ) : Zend_Controller_Response_Abstract

Clear headers

Details
visibility
public
final
false
static
false

clearRawHeader

clearRawHeader( string $headerRaw ) : Zend_Controller_Response_Abstract

Clears the specified raw HTTP header

Arguments
$headerRaw
string
Details
visibility
public
final
false
static
false

clearRawHeaders

clearRawHeaders( ) : Zend_Controller_Response_Abstract

Clear all {@link setRawHeader() raw HTTP headers}

Details
visibility
public
final
false
static
false

getBody

getBody( boolean $spec = false ) : string|array|null

Return the body content

If $spec is false, returns the concatenated values of the body content array. If $spec is boolean true, returns the body content array. If $spec is a string and matches a named segment, returns the contents of that segment; otherwise, returns null.

Arguments
$spec
boolean
Output
string|array|null
Details
visibility
public
final
false
static
false

getException

getException( ) : array

Retrieve the exception stack

Output
array
Details
visibility
public
final
false
static
false

getExceptionByCode

getExceptionByCode( mixed $code ) : void

Retrieve all exceptions of a given code

Arguments
$code
mixed
Details
visibility
public
final
false
static
false

getExceptionByMessage

getExceptionByMessage( string $message ) : false|array

Retrieve all exceptions of a given message

Arguments
$message
string
Output
false|array
Details
visibility
public
final
false
static
false

getExceptionByType

getExceptionByType( string $type ) : false|array

Retrieve all exceptions of a given type

Arguments
$type
string
Output
false|array
Details
visibility
public
final
false
static
false

getHeaders

getHeaders( ) : array

Return array of headers; see {@link $_headers} for format

Output
array
Details
visibility
public
final
false
static
false

getHttpResponseCode

getHttpResponseCode( ) : int

Retrieve HTTP response code

Output
int
Details
visibility
public
final
false
static
false

getRawHeaders

getRawHeaders( ) : array

Retrieve all {@link setRawHeader() raw HTTP headers}

Output
array
Details
visibility
public
final
false
static
false

hasExceptionOfCode

hasExceptionOfCode( int $code ) : boolean

Does the response object contain an exception with a given code?

Arguments
$code
int
Output
boolean
Details
visibility
public
final
false
static
false

hasExceptionOfMessage

hasExceptionOfMessage( string $message ) : boolean

Does the response object contain an exception with a given message?

Arguments
$message
string
Output
boolean
Details
visibility
public
final
false
static
false

hasExceptionOfType

hasExceptionOfType( string $type ) : boolean

Does the response object contain an exception of a given type?

Arguments
$type
string
Output
boolean
Details
visibility
public
final
false
static
false

insert

insert( string $name, string $content, string $parent = null, boolean $before = false ) : Zend_Controller_Response_Abstract

Insert a named segment into the body content array

Arguments
$name
string
$content
string
$parent
string
$before
boolean
Whether to insert the new segment before or after the parent. Defaults to false (after)
Details
visibility
public
final
false
static
false

isException

isException( ) : boolean

Has an exception been registered with the response?

Output
boolean
Details
visibility
public
final
false
static
false

isRedirect

isRedirect( ) : boolean

Is this a redirect?

Output
boolean
Details
visibility
public
final
false
static
false

outputBody

outputBody( ) : void

Echo the body segments

Details
visibility
public
final
false
static
false

prepend

prepend( string $name, string $content ) : void

Prepend a named body segment to the body content array

If segment already exists, replaces with $content and places at top of array.

Arguments
$name
string
$content
string
Details
visibility
public
final
false
static
false

renderExceptions

renderExceptions( boolean $flag = null ) : boolean

Whether or not to render exceptions (off by default)

If called with no arguments or a null argument, returns the value of the flag; otherwise, sets it and returns the current value.

Arguments
$flag
boolean
Optional
Output
boolean
Details
visibility
public
final
false
static
false

sendHeaders

sendHeaders( ) : Zend_Controller_Response_Abstract

Send all headers

Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} has been specified, it is sent with the first header.

Details
visibility
public
final
false
static
false

sendResponse

sendResponse( ) : void

Send the response, including all headers, rendering exceptions if so requested.

Details
visibility
public
final
false
static
false

setBody

setBody( string $content, null|string $name = null ) : Zend_Controller_Response_Abstract

Set body content

If $name is not passed, or is not a string, resets the entire body and sets the 'default' key to $content.

If $name is a string, sets the named segment in the body array to $content.

Arguments
$content
string
$name
nullstring
Details
visibility
public
final
false
static
false

setException

setException( Exception $e ) : Zend_Controller_Response_Abstract

Register an exception with the response

Arguments
$e
Exception
Details
visibility
public
final
false
static
false

setHeader

setHeader( string $name, string $value, boolean $replace = false ) : Zend_Controller_Response_Abstract

Set a header

If $replace is true, replaces any headers already defined with that $name.

Arguments
$name
string
$value
string
$replace
boolean
Details
visibility
public
final
false
static
false

setHttpResponseCode

setHttpResponseCode( int $code ) : Zend_Controller_Response_Abstract

Set HTTP response code to use with headers

Arguments
$code
int
Details
visibility
public
final
false
static
false

setRawHeader

setRawHeader( string $value ) : Zend_Controller_Response_Abstract

Set raw HTTP header

Allows setting non key => value headers, such as status codes

Arguments
$value
string
Details
visibility
public
final
false
static
false

setRedirect

setRedirect( string $url, int $code = 302 ) : Zend_Controller_Response_Abstract

Set redirect URL

Sets Location header and response code. Forces replacement of any prior redirects.

Arguments
$url
string
$code
int
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.