NAME
Wombat::Connector::HttpResponseBase - internal http response base class
SYNOPSIS
package My::Connector::HttpResponse;
use base qw(Wombat::Connector::HttpResponseBase);
DESCRIPTION
Convenience base implementation of Wombat::HttpResponse and Servlet::Http::HttpServletResponse which can be used for most connectors that implement the HTTP protocol. Only connector-specific methods need to be implemented. Extends Wombat::Connector::ResponseBase.
CONSTRUCTOR
- new()
-
Construct and return a Wombat::Connector::HttpResponseBase instance, initializing fields appropriately. If subclasses override the constructor, they must be sure to call
$self->SUPER::new();
ACCESSOR METHODS
- getCookies()
-
Return the list of Cookies for this Response.
-
Add the specified Cookie to those that will be included with this Response.
Parameters:
-
the Servlet::Http::Cookie to be added
-
- clearCookies()
-
Clear the list of Cookies for this Response;
- addDateHeader($name, $date)
-
Add a date value for the named response header.
Parameters:
- setDateHeader($name, $date)
-
Set the date value for the named response header.
Parameters:
- addHeader($name, $value)
-
Add a value for the named response header.
Parameters:
- getHeader($name)
-
Return the value for the first occurrence of the named response header. For all values, use
getHeaderValues()
.Parameters:
- getHeaderNames()
-
Return a list of all the header names set for this Response.
- getHeaderValues($name)
-
Return the list of values for the named response header.
Parameters:
- setHeader($name, $value)
-
Set the value for the named response header.
Parameters:
- clearHeaders()
-
Clear the set of headers for this Response;
- setLocale($loc)
-
Set the locale for this Response. The character encoding for this Response will be set to the encoding specified by the locale, and the Content-Language header will be set to the language specified by the locale.
Parameters:
- getMessage()
-
Return the status message for this Response.
- getStatus()
-
Return the HTTP status code for this Response.
- setStatus($code)
-
Set the status code for this response.
Parameters:
PUBLIC METHODS
- containsHeader($name)
-
Return a boolean value indicating whether or not the named response header has already been set.
Parameters:
- encodeRedirectURL($url)
-
Encode the session ID for this Response into the specified redirect URL, if necessary.
Parameters:
- encodeURL($url)
-
Encode the session ID for this Response into the specified URL, if necessary.
Parameters:
- finishResponse()
-
Perform whatever actions are required to flush and close the output handle or writer, including sending headers if the response is not already committed.
Throws:
- flushBuffer()
-
Force any content in the buffer to be written to the client. Headers are automatically sent and the response is committed on the first invocation of this method.
Throws:
- reset()
-
Clear any data that exists in the content buffer and unsets the content length and content type, all cookies and headers, and the status and message.
Throws:
- sendError($code, [$message])
-
Send an error response with the specified status and optional message.
Parameters:
- $code
-
the error status code
- $message
-
the optional descriptive message; if unspecified, the standard message for the given status code will be used.
Throws:
- sendRedirect($location)
-
Send a temporary redirect to the specified URL.
Parameters:
Throws:
PACKAGE METHODS
- sendHeaders()
-
Write response headers to the output handle, committing the response. Usually doesn't need to be called by other classes, but will be called the first time the buffer is flushed.
- recycle()
-
Release all object references and initialize instances variables in preparation for use or reuse of this object.
SEE ALSO
Servlet::ServletResponse, Servlet::Http::Cookie, Servlet::Util::Exception, Wombat::HttpResponse, Wombat::Connector::ResponseBase
AUTHOR
Brian Moseley, bcm@maz.org