Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

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

Interfaces

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

Class Response

HttpResponse class.

Nette\Http\Response implements Nette\Http\IResponse uses Nette\SmartObject
Namespace: Nette\Http
Located at Http/Response.php
Methods summary
public
# __construct( )
public Nette\Http\Response
# setCode( integer $code, string $reason = null )

Sets HTTP response code.

Sets HTTP response code.

Parameters

$code
$reason

Returns

Nette\Http\Response
static

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
int

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
name
$value
value

Returns

Nette\Http\Response
static

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
name
$value
value

Returns

Nette\Http\Response
static

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
mime-type
$charset
charset

Returns

Nette\Http\Response
static

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
URL
$code
code

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::redirect()
public Nette\Http\Response
# setExpiration( string|integer|DateTimeInterface $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
value 0 means "must-revalidate"

Returns

Nette\Http\Response
static

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
bool

Implementation of

Nette\Http\IResponse::isSent()
public string|null
# getHeader( string $header, string|null $default = null )

Returns value of an HTTP header.

Returns value of an HTTP header.

Parameters

$header
$default

Returns

string|null
string|null

Implementation of

Nette\Http\IResponse::getHeader()
public array
# getHeaders( )

Returns a list of headers to sent.

Returns a list of headers to sent.

Returns

array
(name => value)

Implementation of

Nette\Http\IResponse::getHeaders()
public static
# date( $time = null )

Deprecated

public
# __destruct( )
public Nette\Http\Response
# setCookie( string $name, string $value, string|integer|DateTimeInterface $time, string $path = null, string $domain = null, boolean $secure = null, boolean $httpOnly = null, string $sameSite = null )

Sends a cookie.

Sends a cookie.

Parameters

$name
of the cookie
$value
value
$time
time, value 0 means "until the browser is closed"
$path
$domain
$secure
$httpOnly
$sameSite

Returns

Nette\Http\Response
static

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
of the cookie.
$path
$domain
$secure

Throws

Nette\InvalidStateException
if HTTP headers have been sent

Implementation of

Nette\Http\IResponse::deleteCookie()
Methods used from Nette\SmartObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants inherited from Nette\Http\IResponse
BROWSER, PERMANENT, S100_CONTINUE, S101_SWITCHING_PROTOCOLS, S102_PROCESSING, S200_OK, S201_CREATED, S202_ACCEPTED, S203_NON_AUTHORITATIVE_INFORMATION, S204_NO_CONTENT, S205_RESET_CONTENT, S206_PARTIAL_CONTENT, S207_MULTI_STATUS, S208_ALREADY_REPORTED, S226_IM_USED, S300_MULTIPLE_CHOICES, S301_MOVED_PERMANENTLY, S302_FOUND, S303_POST_GET, S303_SEE_OTHER, S304_NOT_MODIFIED, S305_USE_PROXY, S307_TEMPORARY_REDIRECT, S308_PERMANENT_REDIRECT, S400_BAD_REQUEST, S401_UNAUTHORIZED, S402_PAYMENT_REQUIRED, S403_FORBIDDEN, S404_NOT_FOUND, S405_METHOD_NOT_ALLOWED, S406_NOT_ACCEPTABLE, S407_PROXY_AUTHENTICATION_REQUIRED, S408_REQUEST_TIMEOUT, S409_CONFLICT, S410_GONE, S411_LENGTH_REQUIRED, S412_PRECONDITION_FAILED, S413_REQUEST_ENTITY_TOO_LARGE, S414_REQUEST_URI_TOO_LONG, S415_UNSUPPORTED_MEDIA_TYPE, S416_REQUESTED_RANGE_NOT_SATISFIABLE, S417_EXPECTATION_FAILED, S421_MISDIRECTED_REQUEST, S422_UNPROCESSABLE_ENTITY, S423_LOCKED, S424_FAILED_DEPENDENCY, S426_UPGRADE_REQUIRED, S428_PRECONDITION_REQUIRED, S429_TOO_MANY_REQUESTS, S431_REQUEST_HEADER_FIELDS_TOO_LARGE, S451_UNAVAILABLE_FOR_LEGAL_REASONS, S500_INTERNAL_SERVER_ERROR, S501_NOT_IMPLEMENTED, S502_BAD_GATEWAY, S503_SERVICE_UNAVAILABLE, S504_GATEWAY_TIMEOUT, S505_HTTP_VERSION_NOT_SUPPORTED, S506_VARIANT_ALSO_NEGOTIATES, S507_INSUFFICIENT_STORAGE, S508_LOOP_DETECTED, S510_NOT_EXTENDED, S511_NETWORK_AUTHENTICATION_REQUIRED
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 boolean $cookieSecure

Whether the cookie is available only through HTTPS

Whether the cookie is available only through HTTPS

#false
public boolean $cookieHttpOnly

Whether the cookie is hidden from client-side

Whether the cookie is hidden from client-side

#true
public boolean $warnOnBuffer

Whether warn on possible problem with data in output buffer

Whether warn on possible problem with data in output buffer

#true
Magic properties summary
public read-only array $headers
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0