Wombat::Connector::ResponseBase - internal response base class
package My::Connector::Response; use base qw(Wombat::Connector::ResponseBase);
Convenience base implementation of Wombat::Response and Servlet::ServletResponse which can be used for most connectors. Only connector-specific methods need to be implemented.
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();
Return the Application within which this Response is being generated.
Set the Application within which this Response is being generated. This must be called as soon as the appropriate Application is identified.
Parameters:
the Wombat::Application within which the Response is being generated
Return the buffer size (in bytes) used for the response.
Set the preferred buffer size for the body of the response.
the buffer size, in bytes
Throws:
if content has been written to the buffer
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 with setLocale().
setContentType()
setLocale()
Return a flag indicating if this Response has been committed.
Return the Connector through which this Response is returned.
Set the Connector through which this response is returned.
the Wombat::Connector that will return the response
Return the number of bytes actually written to the output handle.
Return the content length, in bytes, that was set or calculated for this Response.
Set the length of the content body in this Response.
the content length, in bytes
Return the MIME type that was set or calculated for this response.
Set the content type of this Response. If the charset parameter is specified, the character encoding of this Response is also set.
charset
the MIME type of the content
Return a flag indicating whether or not this is an error response.
Set a flag indicating that this Response is an error response.
Return the output handle associated with this Response.
Set the output handle ssociated with this Response.
the IO::Handle associated with this response
Return a flag indicating whether or not this Response is being processed as an include.
Set a flag indicating whether or not this Response is being processed as an include.
a boolean value indicating whether or not this response is included
Return the locale assigned to this Response.
Set the locale for this Response. The character encoding for this Response will be set to the encoding specified by the locale.
the locale for the response
Return the Servlet::ServletOutputHandle that wraps the underlying output handle (see getHandle(). The default implementation returns a handle created by createOutputHandle().
getHandle()
createOutputHandle()
if the getWriter() method has already been called for this response
getWriter()
if an input or output exception occurred
Return the Request with which this Response is associated.
Set the Request with which this Response is associated.
the Wombat::Request with which this response is associated
Return the ServletResponse for which this object is the facade.
Return the XXX that wraps the ServletOutputHandle for this response. The default implementation returns a XXX wrapped around the handle created by createOutputHandle().
if the charset specified in setContentType() cannot be used
if the getOutputHandle() method has already been called for this request
getOutputHandle()
Create and return a Servlet::ServletOutputHandle to write the response content.
if an input or output error occurs
Perform whatever actions are required to flush and close the output handle or writer.
Force any content in the buffer to be written to the client. The response is automatically committed on the first invocation of this method.
Clear any data that exists in the content buffer and unset the content length and content type.
if the response has already been committed
Clear the content of the content buffer in the response without modifying any other fields.
These methods should only ever be called by other classes in the Wombat::Connector namespace. Other packages should use the public API only!
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).
Release all object references and initialize instances variables in preparation for use or reuse of this object.
IO::Handle, Servlet::ServletResponse, Servlet::ServletServletOutputHandle, Servlet::Util::Exception, Wombat::Application, Wombat::Connector, Wombat::Request, Wombat::Response
Brian Moseley, bcm@maz.org
To install Wombat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wombat
CPAN shell
perl -MCPAN -e shell install Wombat
For more information on module installation, please visit the detailed CPAN module installation guide.