Packages

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

Classes

  • NFtp
  • NHtml
  • NHttpContext
  • NHttpRequest
  • NHttpResponse
  • NHttpUploadedFile
  • NSession
  • NSessionNamespace
  • NUri
  • NUriScript
  • NUser

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • NFtpException
  • Overview
  • Package
  • Class
  • Tree

Class NHttpResponse

HttpResponse class.

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

Sets HTTP response code.

Sets HTTP response code.

Parameters

$code
integer

Returns

NHttpResponse
provides a fluent interface

Throws

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

Implementation of

IHttpResponse::setCode
public integer
# getCode( )

Returns HTTP response code.

Returns HTTP response code.

Returns

integer

Implementation of

IHttpResponse::getCode
public NHttpResponse
# 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

NHttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

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

IHttpResponse::addHeader
public NHttpResponse
# 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

NHttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

IHttpResponse::setContentType
public
# redirect( string $url, integer $code = 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

IHttpResponse::redirect
public NHttpResponse
# 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

NHttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

IHttpResponse::setExpiration
public boolean
# isSent( )

Checks if headers have been sent.

Checks if headers have been sent.

Returns

boolean

Implementation of

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

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 NHttpResponse
# 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

NHttpResponse
provides a fluent interface

Throws

InvalidStateException
if HTTP headers have been sent

Implementation of

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

IHttpResponse::deleteCookie
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants inherited from 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 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0