symfony API

sfWebResponse Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 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)
    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)

    $name HTTP header
    $value Value for the http header

    Adds an control cache http header.

  • addHttpMeta ($key, $value, $replace)

    $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)

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

    Adds javascript code to the current web response.

  • addMeta ($key, $value, $replace, $escape)

    $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)

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

    Adds a stylesheet to the current web response.

  • addVaryHttpHeader ($header)

    $header HTTP header

    Adds vary to a http header.

  • clearHttpHeaders ()

    Cleans HTTP headers from the current web response.

  • copyProperties ($response)

    $response An sfWebResponse instance

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

  • (string) fixContentType ($contentType)

    $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 ()

    Gets the current charset as defined by the content type.

    returns The current charset

  • (array) getContentType ()

    Gets response content type.

  • (array) getCookies ()

    Retrieves cookies from the current web response.

    returns Cookies

  • (string) getDate ($timestamp, $type)

    $timestamp Timestamp
    $type Format type

    Retrieves a formated date.

    returns Formatted date

  • (string) getHttpHeader ($name, $default)

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

    Gets HTTP header current value.

  • (string) getHttpHeaders ()

    Retrieves HTTP headers from the current web response.

    returns HTTP headers

  • (string) getHttpMetas ()

    Retrieves meta headers for the current web response.

    returns Meta headers

  • (array) getJavascripts ($position)

    $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 ()

    Retrieves all meta headers.

    returns List of meta headers

  • (array) getPositions ()

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

    returns An array of position names

  • (string) getSlots ()

    Retrieves slots from the current web response.

    returns Javascript code

  • (integer) getStatusCode ()

    Retrieves status code for the current web response.

    returns Status code

  • (string) getStatusText ()

    Retrieves status text for the current web response.

    returns Status text

  • (array) getStylesheets ($position)

    $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 ()

    Retrieves title for the current web response.

    returns Title

  • (bool) hasHttpHeader ($name)

    $name HTTP header name

    Checks if response has given HTTP header.

  • (bool) initialize ($dispatcher, $options)

    $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 ()

    Returns if the response must only consist of HTTP headers.

    returns returns true if, false otherwise

  • merge ($response)

    $response An sfWebResponse instance

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

  • (string) normalizeHeaderName ($name)

    $name Header name

    Retrieves a normalized Header.

    returns Normalized header

  • removeJavascript ($file)

    $file The Javascript file to remove

    Removes a JavaScript file from the current web response.

  • removeStylesheet ($file)

    $file The stylesheet file to remove

    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.

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

  • serialize ()

    @see sfResponse

  • setContentType ($value)

    $value Content type

    Sets response content type.

  • setCookie ($name, $value, $expire, $path, $domain, $secure, $httpOnly)

    $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)

    Sets if the response consist of just HTTP headers.

  • setHttpHeader ($name, $value, $replace)

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

    Sets a HTTP header.

  • setSlot ($name, $content)

    $name Slot name
    $content Content

    Sets a slot content.

  • setStatusCode ($code, $name)

    $code HTTP status code
    $name HTTP status text

    Sets response status code.

  • setTitle ($title, $escape)

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

    Sets title for the current web response.

  • unserialize ()

    @see sfResponse

  • validatePosition ($position)

    Validate a position name.

    throws InvalidArgumentException if the position is not available