Response¶
-
class
OCP\AppFramework\Http\Response¶ - Base class for responses. Also used to just send headers.It handles headers, HTTP status code, last modified and ETag.
Source: lib/public/AppFramework/Http/Response.php#50
Properties¶
Methods¶
-
public
OCP\AppFramework\Http\Response::__construct()¶ Source: lib/public/AppFramework/Http/Response.php#102 Since: 17.0.0
-
public
OCP\AppFramework\Http\Response::cacheFor($cacheSeconds, $public=false)¶ - Caches the response
Source: Parameters: - $cacheSeconds (int) the amount of seconds that should be cached
if 0 then caching will be disabled
Returns: $this
Since: 6.0.0 - return value was added in 7.0.0
-
public
OCP\AppFramework\Http\Response::addCookie($name, $value, $expireDate=null, $sameSite=Lax)¶ - Adds a new cookie to the response
Source: Parameters: - $name (string) The name of the cookie
- $value (string) The value of the cookie
- $expireDate (
DateTime| null) Date on that the cookie should expire, if set
to null cookie will be considered as session cookie. * $sameSite (string) The samesite value of the cookie. Defaults to Lax. Other possibilities are Strict or None
Returns: $this
Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::setCookies($cookies)¶ - Set the specified cookies
Source: Parameters: - $cookies (array) array(‘foo’ => array(‘value’ => ‘bar’, ‘expire’ => null))
Returns: $this
Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::invalidateCookie($name)¶ - Invalidates the specified cookie
Source: Parameters: - $name (string)
Returns: $this
Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::invalidateCookies($cookieNames)¶ - Invalidates the specified cookies
Source: Parameters: - $cookieNames (array) array(‘foo’, ‘bar’)
Returns: $this
Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::getCookies()¶ - Returns the cookies
Source: lib/public/AppFramework/Http/Response.php#191 Returns: array Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::addHeader($name, $value)¶ - Adds a new header to the response that will be called before the renderfunction
Source: Parameters: - $name (string) The name of the HTTP header
- $value (string) The value, null will delete it
Returns: $this
Since: 6.0.0 - return value was added in 7.0.0
-
public
OCP\AppFramework\Http\Response::setHeaders($headers)¶ - Set the headers
Source: Parameters: - $headers (array) value header pairs
Returns: $this
Since: 8.0.0
-
public
OCP\AppFramework\Http\Response::getHeaders()¶ - Returns the set headers
Source: lib/public/AppFramework/Http/Response.php#248 Returns: array the headers Since: 6.0.0
-
public
OCP\AppFramework\Http\Response::render()¶ - By default renders no output
Source: lib/public/AppFramework/Http/Response.php#273 Returns: string Since: 6.0.0
-
public
OCP\AppFramework\Http\Response::setStatus($status)¶ - Set response status
Source: Parameters: - $status (int) a HTTP status code, see also the STATUS constants
Returns: \OCP\AppFramework\Http\ResponseReference to this objectSince: 6.0.0 - return value was added in 7.0.0
-
public
OCP\AppFramework\Http\Response::setContentSecurityPolicy($csp)¶ - Set a Content-Security-Policy
Source: Parameters: - $csp (
OCP\AppFramework\Http\EmptyContentSecurityPolicy) Policy to set for the response object
Returns: $this
Since: 8.1.0
- $csp (
-
public
OCP\AppFramework\Http\Response::getContentSecurityPolicy()¶ - Get the currently used Content-Security-Policy
Source: lib/public/AppFramework/Http/Response.php#307 Returns: \OCP\AppFramework\Http\EmptyContentSecurityPolicy| null Used Content-Security-Policy or null if none specified.Since: 8.1.0
-
public
OCP\AppFramework\Http\Response::getFeaturePolicy()¶ Source: lib/public/AppFramework/Http/Response.php#318 Since: 17.0.0
-
public
OCP\AppFramework\Http\Response::setFeaturePolicy($featurePolicy)¶ Source: lib/public/AppFramework/Http/Response.php#328 Since: 17.0.0
-
public
OCP\AppFramework\Http\Response::getStatus()¶ - Get response status
Source: lib/public/AppFramework/Http/Response.php#340 Since: 6.0.0
-
public
OCP\AppFramework\Http\Response::getETag()¶ - Get the ETag
Source: lib/public/AppFramework/Http/Response.php#350 Returns: string the etag Since: 6.0.0
-
public
OCP\AppFramework\Http\Response::getLastModified()¶ - Get “last modified” date
Source: lib/public/AppFramework/Http/Response.php#360 Returns: \DateTimeRFC2822 formatted last modified dateSince: 6.0.0
-
public
OCP\AppFramework\Http\Response::setETag($ETag)¶ - Set the ETag
Source: Parameters: - $ETag (string)
Returns: \OCP\AppFramework\Http\ResponseReference to this objectSince: 6.0.0 - return value was added in 7.0.0
-
public
OCP\AppFramework\Http\Response::setLastModified($lastModified)¶ - Set “last modified” date
Source: Parameters: - $lastModified (
DateTime)
Returns: \OCP\AppFramework\Http\ResponseReference to this objectSince: 6.0.0 - return value was added in 7.0.0
- $lastModified (
-
public
OCP\AppFramework\Http\Response::throttle($metadata=[])¶ - Marks the response as to throttle. Will be throttled when the
Source: Parameters: - $metadata (array)
Since: 12.0.0
-
public
OCP\AppFramework\Http\Response::getThrottleMetadata()¶ - Returns the throttle metadata, defaults to empty array
Source: lib/public/AppFramework/Http/Response.php#408 Returns: array Since: 13.0.0
-
public
OCP\AppFramework\Http\Response::isThrottled()¶ - Whether the current response is throttled.
Source: lib/public/AppFramework/Http/Response.php#417 Since: 12.0.0