Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • Ftp
  • Html
  • HttpContext
  • HttpRequest
  • HttpResponse
  • HttpUploadedFile
  • Session
  • SessionNamespace
  • Uri
  • UriScript
  • User

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • FtpException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class HttpResponse

HttpResponse class.

Nette\Object
Extended by Nette\Web\HttpResponse implements Nette\Web\IHttpResponse
Final
Namespace: Nette\Web
Author: David Grudl
Located at Web/HttpResponse.php
Methods summary
public Nette\Web\HttpResponse
# setCode( integer $code )

Sets HTTP response code.

Sets HTTP response code.

Parameters

$code
integer

Returns

Nette\Web\HttpResponse
provides a fluent interface

Throws

InvalidArgumentException
if code is invalid
InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::setCode
public integer
# getCode( )

Returns HTTP response code.

Returns HTTP response code.

Returns

integer

Implementation of

Nette\Web\IHttpResponse::getCode
public Nette\Web\HttpResponse
# setHeader( string $name, string $value )

Sends a HTTP header and replaces a previous one.

Sends a HTTP header and replaces a previous one.

Parameters

$name
string
header name
$value
string
header value

Returns

Nette\Web\HttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::setHeader
public
# addHeader( string $name, string $value )

Adds HTTP header.

Adds HTTP header.

Parameters

$name
string
header name
$value
string
header value

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::addHeader
public Nette\Web\HttpResponse
# setContentType( string $type, string $charset = NULL )

Sends a Content-type HTTP header.

Sends a Content-type HTTP header.

Parameters

$type
string
mime-type
$charset
string
charset

Returns

Nette\Web\HttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::setContentType
public
# redirect( string $url, integer $code = Nette\Web\IHttpResponse::S302_FOUND )

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

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

Parameters

$url
string
URL
$code
integer
HTTP code

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::redirect
public Nette\Web\HttpResponse
# setExpiration( string|integer|DateTime $time )

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

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

Parameters

$time
string|integer|DateTime
time, value 0 means "until the browser is closed"

Returns

Nette\Web\HttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::setExpiration
public boolean
# isSent( )

Checks if headers have been sent.

Checks if headers have been sent.

Returns

boolean

Implementation of

Nette\Web\IHttpResponse::isSent
public mixed
# getHeader( string $header, mixed $default = NULL )

Return the value of the HTTP header.

Return the value of the HTTP header.

Parameters

$header
string
$default
mixed

Returns

mixed
public array
# getHeaders( )

Returns a list of headers to sent.

Returns a list of headers to sent.

Returns

array

Implementation of

Nette\Web\IHttpResponse::getHeaders
public static string
# date( string|integer|DateTime $time = NULL )

Returns HTTP valid date format.

Returns HTTP valid date format.

Parameters

$time
string|integer|DateTime

Returns

string
public boolean
# enableCompression( )

Enables compression. (warning: may not work)

Enables compression. (warning: may not work)

Returns

boolean
public
# __destruct( )
public Nette\Web\HttpResponse
# setCookie( string $name, string $value, string|integer|DateTime $time, string $path = NULL, string $domain = NULL, boolean $secure = NULL )

Sends a cookie.

Sends a cookie.

Parameters

$name
string
name of the cookie
$value
string
value
$time
string|integer|DateTime
expiration time, value 0 means "until the browser is closed"
$path
string
$domain
string
$secure
boolean

Returns

Nette\Web\HttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::setCookie
public
# deleteCookie( string $name, string $path = NULL, string $domain = NULL, boolean $secure = NULL )

Deletes a cookie.

Deletes a cookie.

Parameters

$name
string
name of the cookie.
$path
string
$domain
string
$secure
boolean

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Web\IHttpResponse::deleteCookie
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants inherited from Nette\Web\IHttpResponse
BROWSER, PERMANENT, S200_OK, S204_NO_CONTENT, S300_MULTIPLE_CHOICES, S301_MOVED_PERMANENTLY, S302_FOUND, S303_POST_GET, S303_SEE_OTHER, S304_NOT_MODIFIED, S307_TEMPORARY_REDIRECT, S400_BAD_REQUEST, S401_UNAUTHORIZED, S403_FORBIDDEN, S404_NOT_FOUND, S405_METHOD_NOT_ALLOWED, S410_GONE, S500_INTERNAL_SERVER_ERROR, S501_NOT_IMPLEMENTED, S503_SERVICE_UNAVAILABLE
Properties summary
public string $cookieDomain ''
#

The domain in which the cookie will be available

The domain in which the cookie will be available

public string $cookiePath '/'
#

The path in which the cookie will be available

The path in which the cookie will be available

public string $cookieSecure FALSE
#

The path in which the cookie will be available

The path in which the cookie will be available

Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0