NAME
Wombat::Connector::ResponseBase - internal response base class
SYNOPSIS
package My::Connector::Response;
use base qw(Wombat::Connector::ResponseBase);
DESCRIPTION
Convenience base implementation of Wombat::Response and Servlet::ServletResponse which can be used for most connectors. Only connector-specific methods need to be implemented.
CONSTRUCTOR
- new()
-
Construct and return a Wombat::Connector::ResponseBase instance, initializing fields appropriately. If subclasses override the constructor, they must be sure to call
$self->SUPER::new();
ACCESSOR METHODS
- getApplication()
-
Return the Application within which this Response is being generated.
- setApplication($application)
-
Set the Application within which this Response is being generated. This must be called as soon as the appropriate Application is identified.
Parameters:
- getBufferSize()
-
Return the buffer size (in bytes) used for the response.
- setBufferSize($size)
-
Set the preferred buffer size for the body of the response.
Parameters:
Throws:
- getCharacterEncoding()
-
Return the character encoding used in the body of this Response, or ISO-8859-1 if the character encoding is unset. The character encoding is set explicitly with
setContentType()
or implicity withsetLocale()
. - isCommitted()
-
Return a flag indicating if this Response has been committed.
- getConnector()
-
Return the Connector through which this Response is returned.
- setConnector($connector)
-
Set the Connector through which this response is returned.
Parameters:
- getContentCount()
-
Return the number of bytes actually written to the output handle.
- getContentLength()
-
Return the content length, in bytes, that was set or calculated for this Response.
- setContentLength($len)
-
Set the length of the content body in this Response.
Parameters:
- getContentType()
-
Return the MIME type that was set or calculated for this response.
- setContentType($type)
-
Set the content type of this Response. If the
charset
parameter is specified, the character encoding of this Response is also set.Parameters:
- isError()
-
Return a flag indicating whether or not this is an error response.
- setError()
-
Set a flag indicating that this Response is an error response.
- getHandle()
-
Return the output handle associated with this Response.
- setHandle($handle)
-
Set the output handle ssociated with this Response.
Parameters:
- isIncluded()
-
Return a flag indicating whether or not this Response is being processed as an include.
- setIncluded($flag)
-
Set a flag indicating whether or not this Response is being processed as an include.
Parameters:
- getLocale()
-
Return the locale assigned to 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.
Parameters:
- getOutputHandle()
-
Return the Servlet::ServletOutputHandle that wraps the underlying output handle (see
getHandle()
. The default implementation returns a handle created bycreateOutputHandle()
.Throws:
- getRequest()
-
Return the Request with which this Response is associated.
- setRequest($request)
-
Set the Request with which this Response is associated.
Parameters:
- getResponse()
-
Return the ServletResponse for which this object is the facade.
- getWriter()
-
Return the XXX that wraps the ServletOutputHandle for this response. The default implementation returns a XXX wrapped around the handle created by
createOutputHandle()
.Throws:
PUBLIC METHODS
- createOutputHandle()
-
Create and return a Servlet::ServletOutputHandle to write the response content.
Throws:
- finishResponse()
-
Perform whatever actions are required to flush and close the output handle or writer.
Throws:
- flushBuffer()
-
Force any content in the buffer to be written to the client. The response is automatically committed on the first invocation of this method.
Throws:
- reset()
-
Clear any data that exists in the content buffer and unset the content length and content type.
Throws:
- resetBuffer()
-
Clear the content of the content buffer in the response without modifying any other fields.
Throws:
PACKAGE METHODS
These methods should only ever be called by other classes in the Wombat::Connector namespace. Other packages should use the public API only!
- write($string, [$length, [$offset]])
-
Write the specified string to the content buffer and return the number of bytes written. If the operation causes the buffer to be filled, the buffer will be flushed (as many times as necessary).
- recycle()
-
Release all object references and initialize instances variables in preparation for use or reuse of this object.
SEE ALSO
IO::Handle, Servlet::ServletResponse, Servlet::ServletServletOutputHandle, Servlet::Util::Exception, Wombat::Application, Wombat::Connector, Wombat::Request, Wombat::Response
AUTHOR
Brian Moseley, bcm@maz.org