NAME
Wombat::Connector::RequestBase - internal request base class
SYNOPSIS
package My::Connector::Request;
use base qw(Wombat::Connector::RequestBase);
DESCRIPTION
Convenience base implementation of Wombat::Request and Servlet::ServletRequest which can be used for most connectors. Only connector-specific methods need to be implemented.
CONSTRUCTOR
- new()
-
Construct and return a Wombat::Connector::RequestBase 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 request is being processed.
- setApplication($application)
-
Set the Application within which this request is being processed. This must be called as soon as the appropriate Application is identified, because it enables parsing of the request URI.
Parameters:
- getAttribute($name)
-
Return the value of the named attribute.
Parameters:
- getAttributeNames()
-
Return an array containing the names of the attributes available to this request.
- removeAttribute($name)
-
Remove the named attribute from this request.
Parameters:
- setAttribute($name, $value)
-
Set the named attribute in this request.
Parameters:
- getAuthorization()
-
Return the authorization credentials sent with this request.
-
Sets the authorization credentials sent with this request.
Parameters:
-
the authorization credentials
-
- getCharacterEncoding()
-
Return the name of the character encoding used in the body of this request.
- setCharacterEncoding($name)
-
Set the name of the character encoding used for the body of this request. This method must be called prior to reading request parameters or reading input using
getReader()
.Parameters:
Throws:
- getConnector()
-
Return the Connector through which this request was received.
- setConnector($connector)
-
Set the Connector through which this request was received.
Parameters:
- getContentLength()
-
Return the content length, in bytes, of the request body provided by the input handle.
- setContentLength($length)
-
Set the length, in bytes, of the request body provided by the input handle.
Parameters:
- getContentType()
-
Return the MIME type of the body of the request.
- setContentType($type)
-
Set the MIME type of the body of this Request. If the
charset
parameter is specified, the character encoding of this Request is also set.Parameters:
- getHandle()
-
Return the underlying input handle associated with this request. Usually the Socket and Handle for the request are the same object, but this is not required.
- setHandle($handle)
-
Set the input handle ssociated with this request.
Parameters:
- getInputHandle()
-
Return the Servlet::ServletInputHandle that wraps the underlying input handle (see
getHandle()
. The default implementation returns a handle created bycreateInputHandle()
.Throws:
- getLocale()
-
Return the preferred locale that the client will accept content in, based on the value for the first Accept-Language header that was encountered. If the request did not specify a preferred language, the server's default locale is returned.
- getLocales()
-
Return the set of preferred locales specified by the client, based on the values for any Accept-Language headers that were encountered. If the request did not specify a preferred language, the server's default locale is returned.
- addLocale($loc)
-
Add a locale to the set of preferred Locales for this Request.
Parameters:
- clearLocales()
-
Clear the list of locales for this Request.
- getParameter($name)
-
Return the value of the named request parameter. If more than one value is defined, return only the first one.
Parameters:
- getParameterMap()
-
Return a hash of the parameters of this Request. The keys of the hash are the parameter names, and the values of the hash are arrays of parameter values.
- getParameterNames()
-
Return an array containing the names of the parameters contained in this Request.
- getParameterValues($name)
-
Return an array containing all of the values of the named request parameter.
Parameters:
- addParameter($name, @values)
-
Add a named parameter with one or more values to this Request.
Parameters:
- clearParameters()
-
Clear the set of parameters for this Request.
- getProtocol()
-
Return the name and version of the protocol used for the request.
- setProtocol($protocol)
-
Set the name and version of the protocol used for the request in the form protocol/majorVersion.minorVersion.
Parameters:
- getReader()
-
Return the XXX that wraps the ServletInputHandle for this request (see
getInputHandle()
. The default implementation returns a XXX wrapped around handle created bycreateInputHandle()
.Throws:
- getRemoteAddr()
-
Return the remote IP address of the client making this request.
- setRemoteAddr($addr)
-
Set the remote IP address of the client making this request. This value will be used to resolve the name of the remote host if necessary (see
getRemoteHost()
).Parameters:
- getRemoteHost()
-
Return the remote host name of the client making this request.
- setRemoteHost($host)
-
Set the remote host name of the client making this request.
Parameters:
- getRequest()
-
Return the ServletRequest for which this object is the facade.
- getRequestDispatcher($path)
-
Return a Servlet::RequestDispatcher object that acts as a wrapper for the resource located at the given path. The path may be absolute (relative to the context path) or relative to the current request URI.
Parameters:
- getResponse()
-
Return the Response with which this request is associated.
- setResponse()
-
Set the Response with which this request is associated.
Parameters:
- getScheme()
-
Return the name of the scheme used to make this request.
- setScheme($scheme)
-
Set the name of the scheme used to make this request, for example http, https, or ftp.
Parameters:
- isSecure()
-
Return a flag indicating whether or not this request was made using a secure channel.
- setSecure($flag)
-
Set a flag indicating whether or not the request was made using a secure channel.
Parameters:
- getServerName()
-
Return the host name of the server which received this request.
- setServerName($name)
-
Set the host name of the server which received this request.
Parameters:
- getServerPort()
-
Return the port number on which this request was received.
- setServerPort($port)
-
Set the port number on which this request was received.
Parameters:
- getSocket()
-
Return the Socket (if any) through which this request was received. This should only be used to access underlying state information about the Socket, such as the SSL information of a IO::Socket::SSL.
- setSocket($socket)
-
Set the Socket (if any) through which this request was received.
Parameters:
- getWrapper()
-
Return the Wrapper within which this request is being processed.
- setWrapper($wrapper)
-
Set the Wrapper within which this request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the request is ultimately passed to an application servlet.
Parameters:
PUBLIC METHODS
- createInputHandle()
-
Create and return a Servlet::ServletInputHandle to read the content associated with this request.
Throws:
- finishRequest()
-
Perform whatever actions are required to flush and close the input handle or reader.
Throws:
- recycle()
-
Release all object references and initialize instances variables in preparation for use or reuse of this object.
SEE ALSO
IO::Handle, IO::Socket, Servlet::ServletRequest, Servlet::ServletServletInputHandle, Servlet::Util::Exception, Wombat::Application, Wombat::Connector, Wombat::Request, Wombat::Response, Wombat::Wrapper
AUTHOR
Brian Moseley, bcm@maz.org