Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

  • Context
  • FileUpload
  • Request
  • RequestFactory
  • Response
  • Session
  • SessionSection
  • Url
  • UrlScript
  • UserStorage

Interfaces

  • IRequest
  • IResponse
  • ISessionStorage
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Response

HttpResponse class.

Nette\Object
Extended by Nette\Http\Response implements Nette\Http\IResponse
Namespace: Nette\Http
Author: David Grudl
Located at Http/Response.php
Methods summary
public Nette\Http\Response
# setCode( integer $code )

Sets HTTP response code.

Sets HTTP response code.

Parameters

$code
integer

Returns

Nette\Http\Response

Throws

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

Implementation of

Nette\Http\IResponse::setCode()
public integer
# getCode( )

Returns HTTP response code.

Returns HTTP response code.

Returns

integer

Implementation of

Nette\Http\IResponse::getCode()
public Nette\Http\Response
# 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\Http\Response

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::setHeader()
public Nette\Http\Response
# addHeader( string $name, string $value )

Adds HTTP header.

Adds HTTP header.

Parameters

$name
string
header name
$value
string
header value

Returns

Nette\Http\Response

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::addHeader()
public Nette\Http\Response
# 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\Http\Response

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::setContentType()
public
# redirect( string $url, integer $code = Nette\Http\IResponse::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

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::redirect()
public Nette\Http\Response
# 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\Http\Response

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::setExpiration()
public boolean
# isSent( )

Checks if headers have been sent.

Checks if headers have been sent.

Returns

boolean

Implementation of

Nette\Http\IResponse::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\Http\IResponse::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
# __destruct( )
public Nette\Http\Response
# setCookie( string $name, string $value, string|integer|DateTime $time, string $path = NULL, string $domain = NULL, boolean $secure = NULL, boolean $httpOnly = 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
$httpOnly
boolean

Returns

Nette\Http\Response

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::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

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::deleteCookie()
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants inherited from Nette\Http\IResponse
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
#

Whether the cookie is available only through HTTPS

Whether the cookie is available only through HTTPS

public string $cookieHttpOnly TRUE
#

Whether the cookie is hidden from client-side

Whether the cookie is hidden from client-side

Magic properties summary
public integer $code
#
public read-only boolean $sent
#
public read-only array $headers
#
Magic properties inherited from Nette\Object
$reflection
Nette 2.0 API documentation generated by ApiGen 2.8.0