The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Wombat::Connector::HttpRequestBase - internal http request base class

SYNOPSIS

  package My::Connector::HttpRequest;

  use base qw(Wombat::Connector::HttpRequestBase);

DESCRIPTION

Convenience base implementation of Wombat::HttpRequest and Servlet::Http::HttpServletRequest which can be used for most connectors that implement the HTTP protocol. Only connector-specific methods need to be implemented. Extends Wombat::Connector::RequestBase.

CONSTRUCTOR

new()

Construct and return a Wombat::Connector::Http::RequestBase instance, initializing fields appropriately. If subclasses override the constructor, they must be sure to call

  $self->SUPER::new();

PUBLIC METHODS

getAuthType()

Return the authentication type used for this Request.

setAuthType($type)

Set the authentication type used for this request.

Parameters:

$type

the authentication type, as defined in Servlet::Http::HttpServletRequest

getContextPath()

Return the portion of the request URI used to select the Application for the Request.

setContextPath($path)

Set the context path for this Request. This will normally be called when the associated Application is mapping the Request to a particular Wrapper.

Parameters:

$path

the context path

addCookie($cookie)

Add a Cookie to the set of Cookies for this Request. This will normally be called when the Connector is parsing the request headers.

Parameters:

$cookie

the Servlet::Http::Cookie

getCookies()

Return the set of Cookies received with this Request.

clearCookies()

Remove all Cookies for this Request.

getDateHeader($name)

Return the value of the named date header, or -1.

Parameters:

$name

the header name

addHeader($name, $value)

Add a value for the named request header.

Parameters:

$name

the parameter name

$value

the parameter value, scalar

getHeader($name)

Return the first value for the named request header.

getHeaderNames()

Return the names of all headers received for this Request.

getHeaders($name)

Return the list of values for the named request header.

Parameters:

$name

the header name

clearHeaders()

Unset all headers for this Request.

getMethod()

Return the HTTP request method used for this Request.

setMethod($method)

Set the HTTP request method used for this Request.

Parameters:

$method

the request method

getParameter($name)

Return the value of the named request parameter. If more than one value is defined, return only the first one. Extract parameters from the request if not already done.

Parameters:

$name

the name of the parameter

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. Extract parameters from the request if not already done.

getParameterNames()

Return an array containing the names of the parameters contained in this Request. Extract parameters from the request if not already done.

getParameterValues($name)

Return an array containing all of the values of the named request parameter. Extract parameters from the request if not already done.

Parameters:

$name

the name of the parameter

getPathInfo()

Return the path information for this Request.

setPathInfo($path)

Set the path information for this Request. This will normally be called when the associated Application is mapping the Request to a particular Wrapper.

Parameters:

$path

the path information

getPathTranslated()

turn extra path information for this request, translated to a real path.

getQueryString()

Return the query string for this Request.

setQueryString($query)

Set the query string for this Request. This is normally called by the Connector when it parses the request headers.

Parameters:

$query

the query string

getRemoteUser()

Return the name of the remote user that has been authenticated for this Request.

isRequestedSessionIdFromCookie()

Return a flag indicating whether or not the requested session ID for this Request came in through a cookie.

setRequestedSessionCookie($flag)

Set a flag indicating whether or not the requested session ID for this Request came in through a cookie. This is normally called by the Connector when it parses the request headers.

Parameters:

$flag

a boolean value

getRequestedSessionId()

Return the session ID included in this Request, if any.

setRequestedSessionId($id)

Set the requested session ID for this Request. This is normally called by the Connector when it parses the request headers.

Parameters:

$id

the session id

isRequestedSessionIdFromURL()

Return a flag indicating whether or not the requested session ID for this Request came in through the request URL.

setRequestedSessionURL($flag)

Set a flag indicating whether or not the requested session ID for this Request came in through the request URL. This is normally called by the Connector when it parses the request headers.

Parameters:

$flag

a boolean value

getRequestURI()

Return the request URI for this Request.

setRequestURI($uri)

Set the unparsed request URI for this Request. This is normally called by the Connector when it parses the request headers.

Parameters:

$uri

the request URI

getRequestURL()

Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does no tinclude query string parameters.

This method is useful for creating redirect messages and for reporting errors.

getServletPath()

Return the portion of the request URI used to select the servlet that will process this Request.

setServletPath($path)

Set the servlet path for this Request. This is normally called when the associated Application is mapping the Request to a particular Wrapper.

Parameters:

$path

the servlet path

getSession($boolean)

Return the Session associated with this Request, creating one if necessary and requested.

Parameters:

$create

a flag indicating whether or not a session is to be created if one is needed and does not exist

setSession($session)

Set the internal Session associated with this Request.

Parameters:

$session

The Wombat::Core::Session to set

getUserPrincipal()

Return the name of the current authenticated user.

setUserPrincipal($principal)

Set the principal that has been authenticated for this Request. This value is also used to calculate the value to be returned by getRemoteUser().

Parameters:

$principal

the Servlet::Util::Principal to set

PUBLIC METHODS

isRequestedSessionIdValid()

Return a boolean value indicating whether or not the requested session ID is still valid.

isUserInRole($role)

Return a boolean value indicating whether or not the authenticated user principal is associated with the named role.

Parameters:

$role

the name of the role

recycle()

Release all object references and initialize instances variables in preparation for use or reuse of this object.

SEE ALSO

Servlet::Http::HttpServletRequest, Servlet::Util::Principal, Wombat::HttpRequest, Wombat::HttpSession, Wombat::Connector::RequestBase

AUTHOR

Brian Moseley, bcm@maz.org