symfony API

sfWebResponse Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.2 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.2 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfWebResponse class.

Inheritence

sfWebResponse  <  sfResponse

Method Summary

  • addCacheControlHttpHeader($name, $value = null)
    Adds an control cache http header.
  • addHttpMeta($key, $value, $replace = true)
    Adds a HTTP meta header.
  • addJavascript($file, $position = &apos;&apos;, $options = array())
    Adds javascript code to the current web response.
  • addMeta($key, $value, $replace = true, $escape = true)
    Adds a meta header.
  • addStylesheet($file, $position = &apos;&apos;, $options = array())
    Adds a stylesheet to the current web response.
  • addVaryHttpHeader($header)
    Adds vary to a http header.
  • clearHttpHeaders()
    Cleans HTTP headers from the current web response.
  • copyProperties($response)
    Copies all properties from a given sfWebResponse object to the current one.
  • string fixContentType($contentType)
    Fixes the content type by adding the charset for text content types.
  • string getCharset()
    Gets the current charset as defined by the content type.
  • array getContentType()
    Gets response content type.
  • array getCookies()
    Retrieves cookies from the current web response.
  • string getDate($timestamp, $type = &apos;rfc1123&apos;)
    Retrieves a formated date.
  • array getHttpHeader($name, $default = null)
    Gets HTTP header current value.
  • string getHttpHeaders()
    Retrieves HTTP headers from the current web response.
  • string getHttpMetas()
    Retrieves meta headers for the current web response.
  • array getJavascripts($position = self::ALL)
    Retrieves javascript files from the current web response.
  • array getMetas()
    Retrieves all meta headers.
  • array getPositions()
    Returns the available position names for stylesheets and javascripts in order.
  • string getSlots()
    Retrieves slots from the current web response.
  • integer getStatusCode()
    Retrieves status code for the current web response.
  • string getStatusText()
    Retrieves status text for the current web response.
  • array getStylesheets($position = self::ALL)
    Retrieves stylesheets for the current web response.
  • string getTitle()
    Retrieves title for the current web response.
  • bool hasHttpHeader($name)
    Checks if response has given HTTP header.
  • bool initialize($dispatcher, $options = array())
    Initializes this sfWebResponse.
  • bool isHeaderOnly()
    Returns if the response must only consist of HTTP headers.
  • merge($response)
    Merges all properties from a given sfWebResponse object to the current one.
  • string normalizeHeaderName($name)
    Retrieves a normalized Header.
  • removeJavascript($file)
    Removes a JavaScript file from the current web response.
  • removeStylesheet($file)
    Removes a stylesheet from the current web response.
  • send()
    Sends the HTTP headers and the content.
  • sendContent()
    Send content for the current web response.
  • sendHttpHeaders()
    Sends HTTP headers and cookies.
  • serialize()
  • setContentType($value)
    Sets response content type.
  • setCookie($name, $value, $expire = null, $path = &apos;/&apos;, $domain = &apos;&apos;, $secure = false, $httpOnly = false)
    Sets a cookie.
  • setHeaderOnly($value = true)
    Sets if the response consist of just HTTP headers.
  • setHttpHeader($name, $value, $replace = true)
    Sets a HTTP header.
  • setSlot($name, $content)
    Sets a slot content.
  • setStatusCode($code, $name = null)
    Sets response status code.
  • setTitle($title, $escape = true)
    Sets title for the current web response.
  • unserialize($serialized)
  • validatePosition($position)
    Validate a position name.

Methods inherited from sfResponse

getContent , getOptions , initialize , send , sendContent , serialize , setContent , setEventDispatcher , unserialize , __call , __construct

Method Details

  • addCacheControlHttpHeader ($name, $value = null) Browse code

    $name HTTP header
    $value Value for the http header

    Adds an control cache http header.

  • addHttpMeta ($key, $value, $replace = true) Browse code

    $key Key to replace
    $value HTTP meta header value (if null, remove the HTTP meta)
    $replace Replace or not

    Adds a HTTP meta header.

  • addJavascript ($file, $position = '', $options = array()) Browse code

    $file The JavaScript file
    $position Position
    $options Javascript options

    Adds javascript code to the current web response.

  • addMeta ($key, $value, $replace = true, $escape = true) Browse code

    $key Name of the header
    $value Meta header value (if null, remove the meta)
    $replace true if it's replaceable
    $escape true for escaping the header

    Adds a meta header.

  • addStylesheet ($file, $position = '', $options = array()) Browse code

    $file The stylesheet file
    $position Position
    $options Stylesheet options

    Adds a stylesheet to the current web response.

  • addVaryHttpHeader ($header) Browse code

    $header HTTP header

    Adds vary to a http header.

  • clearHttpHeaders () Browse code

    Cleans HTTP headers from the current web response.

  • copyProperties ($response) Browse code

    $response An sfWebResponse instance

    Copies all properties from a given sfWebResponse object to the current one.

  • (string) fixContentType ($contentType) Browse code

    $contentType The content type

    Fixes the content type by adding the charset for text content types.

    returns The content type with the charset if needed

  • (string) getCharset () Browse code

    Gets the current charset as defined by the content type.

    returns The current charset

  • (array) getContentType () Browse code

    Gets response content type.

  • (array) getCookies () Browse code

    Retrieves cookies from the current web response.

    returns Cookies

  • (string) getDate ($timestamp, $type = 'rfc1123') Browse code

    $timestamp Timestamp
    $type Format type

    Retrieves a formated date.

    returns Formatted date

  • (array) getHttpHeader ($name, $default = null) Browse code

    $name HTTP header name
    $default Default value returned if named HTTP header is not found

    Gets HTTP header current value.

  • (string) getHttpHeaders () Browse code

    Retrieves HTTP headers from the current web response.

    returns HTTP headers

  • (string) getHttpMetas () Browse code

    Retrieves meta headers for the current web response.

    returns Meta headers

  • (array) getJavascripts ($position = self::ALL) Browse code

    $position The position

    Retrieves javascript files from the current web response.


    By default, the position is sfWebResponse::ALL, and the method returns all javascripts ordered by position.

    returns An associative array of javascript files as keys and options as values

  • (array) getMetas () Browse code

    Retrieves all meta headers.

    returns List of meta headers

  • (array) getPositions () Browse code

    Returns the available position names for stylesheets and javascripts in order.

    returns An array of position names

  • (string) getSlots () Browse code

    Retrieves slots from the current web response.

    returns Javascript code

  • (integer) getStatusCode () Browse code

    Retrieves status code for the current web response.

    returns Status code

  • (string) getStatusText () Browse code

    Retrieves status text for the current web response.

    returns Status text

  • (array) getStylesheets ($position = self::ALL) Browse code

    $position The position

    Retrieves stylesheets for the current web response.


    By default, the position is sfWebResponse::ALL, and the method returns all stylesheets ordered by position.

    returns An associative array of stylesheet files as keys and options as values

  • (string) getTitle () Browse code

    Retrieves title for the current web response.

    returns Title

  • (bool) hasHttpHeader ($name) Browse code

    $name HTTP header name

    Checks if response has given HTTP header.

  • (bool) initialize ($dispatcher, $options = array()) Browse code

    $dispatcher An sfEventDispatcher instance
    $options An array of options

    Initializes this sfWebResponse.


    Available options:

    * charset: The charset to use (utf-8 by default)
    * content_type: The content type (text/html by default)
    * send_http_headers: Whether to send HTTP headers or not (true by default)
    * http_protocol: The HTTP protocol to use for the response (HTTP/1.0 by default)

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this sfResponse

  • (bool) isHeaderOnly () Browse code

    Returns if the response must only consist of HTTP headers.

    returns returns true if, false otherwise

  • merge ($response) Browse code

    $response An sfWebResponse instance

    Merges all properties from a given sfWebResponse object to the current one.

  • (string) normalizeHeaderName ($name) Browse code

    $name Header name

    Retrieves a normalized Header.

    returns Normalized header

  • removeJavascript ($file) Browse code

    $file The Javascript file to remove

    Removes a JavaScript file from the current web response.

  • removeStylesheet ($file) Browse code

    $file The stylesheet file to remove

    Removes a stylesheet from the current web response.

  • send () Browse code

    Sends the HTTP headers and the content.

  • sendContent () Browse code

    Send content for the current web response.

  • sendHttpHeaders () Browse code

    Sends HTTP headers and cookies.

  • serialize () Browse code

  • setContentType ($value) Browse code

    $value Content type

    Sets response content type.

  • setCookie ($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false) Browse code

    $name HTTP header name
    $value Value for the cookie
    $expire Cookie expiration period
    $path Path
    $domain Domain name
    $secure If secure
    $httpOnly If uses only HTTP

    Sets a cookie.

    throws sfException If fails to set the cookie

  • setHeaderOnly ($value = true) Browse code

    $value

    Sets if the response consist of just HTTP headers.

  • setHttpHeader ($name, $value, $replace = true) Browse code

    $name HTTP header name
    $value Value (if null, remove the HTTP header)
    $replace Replace for the value

    Sets a HTTP header.

  • setSlot ($name, $content) Browse code

    $name Slot name
    $content Content

    Sets a slot content.

  • setStatusCode ($code, $name = null) Browse code

    $code HTTP status code
    $name HTTP status text

    Sets response status code.

  • setTitle ($title, $escape = true) Browse code

    $title Title name
    $escape true, for escaping the title

    Sets title for the current web response.

  • unserialize ($serialized) Browse code

    $serialized

  • validatePosition ($position) Browse code

    $position

    Validate a position name.

    throws InvalidArgumentException if the position is not available