Class Ismo_Core_Response

Description

Represents the response sent back to the browser.

Located in /Response.php (line 35)


	
			
Method Summary
Ismo_Core_Response Ismo_Core_Response ()
boolean addCookie (Ismo_Core_Cookie $cookie)
boolean addHeader (string $name, string $value, boolean $replace)
void deleteCookie (IsmoCookie $cookie)
boolean sendError (string $code, [string $msg = NULL])
boolean sendRedirect (mixed $location)
void setStatus (string $code)
Methods
Constructor Ismo_Core_Response (line 43)

Constructor, creates a new Ismo_Core_Response.

  • access: public
Ismo_Core_Response Ismo_Core_Response ()
addCookie (line 61)

Adds the specified cookie to the response.

This method can be called multiple times to set more than one cookie or to modify an already set one. Returns true if the adding was successful, false otherwise.

  • return: true if the adding was successful, false otherwise
  • access: public
boolean addCookie (Ismo_Core_Cookie $cookie)
addHeader (line 100)

Adds a response header with the given name and value.

This method allows response headers to have multiple values. Returns true if the header could be added, false otherwise. False will be returned f.g. when the headers have already been sent. The replace parameter indicates if an already existing header with the same name should be replaced or not.

  • return: true if the header could be set, false otherwise
  • access: public
boolean addHeader (string $name, string $value, boolean $replace)
  • string $name: the name of the header
  • string $value: the value of the header
  • boolean $replace: should the header be replaced or not
deleteCookie (line 119)

Deletes the specified cookie from the response.

  • access: public
void deleteCookie (IsmoCookie $cookie)
  • IsmoCookie $cookie: the cookie object to delete
sendError (line 163)

Sends an error response to the client using the specified status code.

Sends an error response to the client using the specified status code. This will create a page that looks like an HTML-formatted server error page containing the specifed message (if any), setting the content type to "text/html", leaving cookies and other headers unmodified.

If the headers have already been sent this method returns false otherwise true. After this method the response should be considered commited, i.e. both headers and data have been sent to the client.

  • return: true if the error response could be send, false otherwise (if the headers have already been sent)
  • access: public
  • todo: decide what the error page should look like
boolean sendError (string $code, [string $msg = NULL])
  • string $code: the status code to use
  • string $msg: the message to show
sendRedirect (line 221)

Sends a temporary redirect respones to the client using the specifed redirect URL.

If the headers have already been sent this method returns false otherwise true. After this method the response should be considered commited.

Examples:

  1. $u = new Ismo_Core_Url("http://a.b.c");
  2. $response->sendRedirect($u);
Redirects the browser to http://a.b.c using an Ismo_Core_Url instance.

  1. $response->sendRedirect("http://d.e.f");
Redirects the browser to http://d.e.f using a string.

  • return: false if the headers have already been sent, true otherwise
  • access: public
boolean sendRedirect (mixed $location)
  • mixed $location: url to redirect to, this can either be an Ismo_Core_Url instance or a string
setStatus (line 254)

Sets the status code for this request.

Sets the status code for this response. This method is used to set the return status code when there is no error (for example, for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, and the caller wishes to provide a message for the response, the sendError() method should be used instead.

void setStatus (string $code)
  • string $code: the status code to set

Documentation generated on Mon, 14 Jun 2004 11:59:35 +0200 by phpDocumentor 1.3.0RC3