Interface IHttpResponse (namespace Nette\Web)


IHttpResponse interface.


Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Web/IHttpResponse.php (line 30)
Public Method Summary
void
addHeader (string $name, string $value)
Adds HTTP header.
void
deleteCookie (string $name, [string $path = NULL], [string $domain = NULL], [bool $secure = NULL])
Deletes a cookie.
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.
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)
Sends a HTTP header and replaces a previous one.
Constant Summary
int BROWSER 0

line 36

int PERMANENT 2116333333

line 33

int S200_OK 200

line 40

HTTP 1.1 response code
int S204_NO_CONTENT 204

line 41

HTTP 1.1 response code
int S300_MULTIPLE_CHOICES 300

line 42

HTTP 1.1 response code
int S301_MOVED_PERMANENTLY 301

line 43

HTTP 1.1 response code
int S302_FOUND 302

line 44

HTTP 1.1 response code
int S303_POST_GET 303

line 46

HTTP 1.1 response code
int S303_SEE_OTHER 303

line 45

HTTP 1.1 response code
int S304_NOT_MODIFIED 304

line 47

HTTP 1.1 response code
int S307_TEMPORARY_REDIRECT 307

line 48

HTTP 1.1 response code
int S400_BAD_REQUEST 400

line 49

HTTP 1.1 response code
int S401_UNAUTHORIZED 401

line 50

HTTP 1.1 response code
int S403_FORBIDDEN 403

line 51

HTTP 1.1 response code
int S404_NOT_FOUND 404

line 52

HTTP 1.1 response code
int S410_GONE 410

line 53

HTTP 1.1 response code
int S500_INTERNAL_SERVER_ERROR 500

line 54

HTTP 1.1 response code
int S501_NOT_IMPLEMENTED 501

line 55

HTTP 1.1 response code
int S503_SERVICE_UNAVAILABLE 503

line 56

HTTP 1.1 response code

Method Details

line 86

addHeader

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

Adds HTTP header.

Input
string $name header name
string $value header value

line 143

deleteCookie

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

Deletes a cookie.

Input
string $name name of the cookie.
string $path
string $domain
bool $secure

line 109

expire

public void expire (int $time)

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

Input
int $time timestamp or number of seconds

line 70

getCode

public int getCode ()

Returns HTTP response code.

line 121

getHeaders

public array getHeaders ()

Returns a list of headers to sent.

line 115

isSent

public bool isSent ()

Checks if headers have been sent.

line 102

redirect

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

Redirects to a new URL.

Input
string $url URL
int $code HTTP code

line 64

setCode

public bool setCode (int $code)

Sets HTTP response code.

Input
int $code

line 94

setContentType

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

Sends a Content-type HTTP header.

Input
string $type mime-type
string $charset charset

line 133

setCookie

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

Sends a cookie.

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

line 78

setHeader

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

Sends a HTTP header and replaces a previous one.

Input
string $name header name
string $value header value