Wombat::Connector::HttpResponseBase - internal http response base class

- NAME
- SYNOPSIS
- DESCRIPTION
- CONSTRUCTOR
- ACCESSOR METHODS
- PUBLIC METHODS
- PACKAGE METHODS
- SEE ALSO
- AUTHOR

# 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.

`addCookie($cookie)`
  Add the specified Cookie to those that will be included with this Response.

  Parameters:

  $cookie
    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:

  $name
    the name of the response header

  $date
    the additional header value

setDateHeader($name, $date)
  Set the date value for the named response header.

  Parameters:

  $name
    the name of the header

  $date
    the header value

addHeader($name, $value)
  Add a value for the named response header.

  Parameters:

  $name
    the name of the response header

  $value
    the additional header value

`getHeader($name)`
  Return the value for the first occurrence of the named response header. For all values, use `getHeaderValues()`.

  Parameters:

  $name
    the header name

`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:

  $name
    the header name

setHeader($name, $value)
  Set the value for the named response header.

  Parameters:

  $name
    the name of the response header

  $value
    the header value

`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:

  $loc
    the locale for the response

`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:

  $code
    the HTTP status code

# PUBLIC METHODS

`containsHeader($name)`
  Return a boolean value indicating whether or not the named response header has already been set.

  Parameters:

  $name
    the name of the header

`encodeRedirectURL($url)`
  Encode the session ID for this Response into the specified redirect URL, if necessary.

  Parameters:

  $url
    the url to be encoded

`encodeURL($url)`
  Encode the session ID for this Response into the specified URL, if necessary.

  Parameters:

  $url
    the url to be encoded

`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:

  Servlet::Util::IOException
    if an input or output error occurs

`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:

  Servlet::Util::IOException
`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:

  Servlet::Util::IllegalStateException
    if the response has already been committed

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:

  Servlet::Util::IOException
    if an input or output exception occurs

  Servlet::Util::IllegalStateException
    if the response has already been committed

`sendRedirect($location)`
  Send a temporary redirect to the specified URL.

  Parameters:

  $location
    the redirect location URL

  Throws:

  Servlet::Util::IOException
    if an input or output exception occurs

  Servlet::Util::IllegalStateException
    if the response has already been committed

# 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

the Servlet::ServletResponse manpage, the Servlet::Http::Cookie manpage, the Servlet::Util::Exception manpage, the Wombat::HttpResponse manpage, the Wombat::Connector::ResponseBase manpage

# AUTHOR

Brian Moseley, bcm@maz.org