symfony API

sfWebResponse Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.3 version. Switch to:

sfWebResponse class.

Inheritence

sfWebResponse  <  sfResponse

Method Summary

  • addCacheControlHttpHeader($name, $value)
    Adds an control cache http header.
  • addHttpMeta($key, $value, $replace)
    Adds a HTTP meta header.
  • addJavascript($file, $position, $options)
    Adds javascript code to the current web response.
  • addMeta($key, $value, $replace, $escape)
    Adds a meta header.
  • addStylesheet($file, $position, $options)
    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)
    Retrieves a formated date.
  • string getHttpHeader($name, $default)
    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)
    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)
    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)
    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. Only the first invocation of this method will send the headers.
  • serialize()
    @see sfResponse
  • setContentType($value)
    Sets response content type.
  • setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly)
    Sets a cookie.
  • setHeaderOnly($value)
    Sets if the response consist of just HTTP headers.
  • setHttpHeader($name, $value, $replace)
    Sets a HTTP header.
  • setSlot($name, $content)
    Sets a slot content.
  • setStatusCode($code, $name)
    Sets response status code.
  • setTitle($title, $escape)
    Sets title for the current web response.
  • unserialize()
    @see sfResponse
  • 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) Browse code

    $name HTTP header
    $value Value for the http header

    Adds an control cache http header.

  • addHttpMeta ($key, $value, $replace) 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) Browse code

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

    Adds javascript code to the current web response.

  • addMeta ($key, $value, $replace, $escape) 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) 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) Browse code

    $timestamp Timestamp
    $type Format type

    Retrieves a formated date.

    returns Formatted date

  • (string) getHttpHeader ($name, $default) 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) 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) 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) 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. Only the first invocation of this method will send the headers.

    Subsequent invocations will silently do nothing. This allows certain actions to send headers early,
    while still using the standard controller.

  • serialize () Browse code

    @see sfResponse

  • setContentType ($value) Browse code

    $value Content type

    Sets response content type.

  • setCookie ($name, $value, $expire, $path, $domain, $secure, $httpOnly) 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) Browse code

    Sets if the response consist of just HTTP headers.

  • setHttpHeader ($name, $value, $replace) 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) Browse code

    $code HTTP status code
    $name HTTP status text

    Sets response status code.

  • setTitle ($title, $escape) Browse code

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

    Sets title for the current web response.

  • unserialize () Browse code

    @see sfResponse

  • validatePosition ($position) Browse code

    Validate a position name.

    throws InvalidArgumentException if the position is not available