Class HttpResponse (namespace Nette\Web)


HttpResponse class.

Object
   |
   --HttpResponse

Implements interfaces:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Web/HttpResponse.php (line 36)
Public Method Summary
void
void
addHeader (string $name, string $value)
Adds HTTP header.
static string
date ([int $time = NULL])
Returns HTTP valid date format.
void
deleteCookie (string $name, [string $path = NULL], [string $domain = NULL], [bool $secure = NULL])
Deletes a cookie.
bool
Enables compression. (warning: may not work)
void
expire (int $time)
Sets the number of seconds before a page cached on a browser expires.
int
getCode ()
Returns HTTP response code.
array
Returns a list of headers to sent.
bool
isSent ()
Checks if headers have been sent.
void
redirect (string $url, [int $code = self::S302_FOUND])
Redirects to a new URL. Note: call exit() after it.
bool
setCode (int $code)
Sets HTTP response code.
void
setContentType (string $type, [string $charset = NULL])
Sends a Content-type HTTP header.
void
setCookie (string $name, string $value, int $expire, [string $path = NULL], [string $domain = NULL], [bool $secure = NULL])
Sends a cookie.
void
setHeader (string $name, string $value, [$replace = TRUE])
Sends a HTTP header and replaces a previous one.
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary
string $cookieDomain ''

line 42

The domain in which the cookie will be available
string $cookiePath ''

line 45

The path in which the cookie will be available
string $cookieSecure FALSE

line 48

The path in which the cookie will be available

Method Details

line 260

__destruct

public void __destruct ()

Output
void  

line 125

addHeader

public void addHeader (string $name, string $value)

Adds HTTP header.

Implementation of:

Input
string $name header name
string $value header value
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 222

date

public static string date ([int $time = NULL])

Returns HTTP valid date format.

Input
int $time timestamp
Output
string  

line 315

deleteCookie

public void deleteCookie (string $name, [string $path = NULL], [string $domain = NULL], [bool $secure = NULL])

Deletes a cookie.

Implementation of:

Input
string $name name of the cookie.
string $path
string $domain
bool $secure
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 233

enableCompression

public bool enableCompression ()

Enables compression. (warning: may not work)

Output
bool  

line 173

expire

public void expire (int $time)

Sets the number of seconds before a page cached on a browser expires.

Implementation of:

Input
int $time timestamp or number of seconds
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 93

getCode

public int getCode ()

Returns HTTP response code.

Implementation of:

Output
int  

line 205

getHeaders

public array getHeaders ()

Returns a list of headers to sent.

Implementation of:

Output
array  

line 194

isSent

public bool isSent ()

Checks if headers have been sent.

Implementation of:

Output
bool  

line 157

redirect

public void redirect (string $url, [int $code = self::S302_FOUND])

Redirects to a new URL. Note: call exit() after it.

Implementation of:

Input
string $url URL
int $code HTTP code
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 62

setCode

public bool setCode (int $code)

Sets HTTP response code.

Implementation of:

Input
int $code
Output
bool  
Throws
throws InvalidStateException if HTTP headers have been sent
throws InvalidArgumentException if code is invalid

line 143

setContentType

public void setContentType (string $type, [string $charset = NULL])

Sends a Content-type HTTP header.

Implementation of:

Input
string $type mime-type
string $charset charset
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 287

setCookie

public void setCookie (string $name, string $value, int $expire, [string $path = NULL], [string $domain = NULL], [bool $secure = NULL])

Sends a cookie.

Implementation of:

Input
string $name name of the cookie
string $value value
int $expire expiration as unix timestamp or number of seconds; Value 0 means "until the browser is closed"
string $path
string $domain
bool $secure
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent

line 107

setHeader

public void setHeader (string $name, string $value, [$replace = TRUE])

Sends a HTTP header and replaces a previous one.

Implementation of:

Input
string $name header name
string $value header value
$replace
Output
void  
Throws
throws InvalidStateException if HTTP headers have been sent