SUMMARY: CONSTR | METHOD DETAIL: CONSTR | METHOD

Class HTTP::Daemon::Threaded::Content

Inherits from:
HTTP::Daemon::Threaded::Logable

Base class for Content classes. Provides an interface definition for generating or storing content, or generating a header, given an HTTP::Request, a URI, URL parameters or POSTed content, HTTP::Daemon::Threaded::SessionCache object, and a HTTP::Daemon::Threaded::ContentParams context

Copyright© 2006, Dean Arnold, Presicient Corp., USA
All rights reserved.

Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.

Author:
D. Arnold
Version:
0.90
Since:
2006-08-21

Unless otherwise noted, $self is the object instance variable.

Constructor Summary
new(LogLevel => value, EventLogger => value, SessionCache => value, ContentParams => value)
          Stores ContentParams, SessionCache, and Logger objects, and performs any content-specific initialization

Method Summary
getContent($fd, $request, $uri, $params, $session)
          Generate and send content
getHeader($fd, $request, $uri, $params, $session)
          Generate and send content header only
putContent($fd, $request, $uri, $content, $session)
          Put content
setCookie($res, $session)
          Set a response cookie

Constructor Details

new

new(LogLevel => value, EventLogger => value, SessionCache => value, ContentParams => value)

Stores ContentParams, SessionCache, and Logger objects, and performs any content-specific initialization.

Parameters:
LogLevel => (optional) logging level; 1 => errors only; 2 => errors and warnings only; 3 => errors, warnings, and info messages; default 1
EventLogger => (optional) Instance of a HTTP::Daemon::Threaded::Logger to receive event notifications (except for web requests)
SessionCache => (optional) threads::shared object implementing HTTP::Daemon::Threaded::SessionCache
ContentParams => (optional) name of a ContentsParam concrete implementation @returns a HTTP::Daemon::Threaded::Content object

Method Details

getContent

getContent($fd, $request, $uri, $params, $session)

Generate and send content. Uses input URI, URL parameters, Cookie and Session objects to load and/or generate content, including providing any needed HTTP headers. Note that the $params parameter may be an array of multipart HTTP::Message objects if a multipart POST request was received (e.g., for file upload).

Content handlers should restrict the HTTP::Daemon::ClientConn response methods to send_response(), send_file_response(), send_error(), or send_redirect(), as HTTP::Daemon::Threaded::Socket provides automatic web logging for those methods.

Parameters:
$fd - HTTP::Daemon::Threaded::Socket object for the client
$request - HTTP::Request object
$uri - request URI
$params - hashref of URL parameters (key => value) OR arrayref of HTTP::Message objects (for multipart POSTs)
$session - (optional) a HTTP::Daemon::Threaded::Session object, if the application configured a SessionCache class, and if WebClient was able to recover an existing session from such a SessionCache.

getHeader

getHeader($fd, $request, $uri, $params, $session)

Generate and send content header only. Uses input URI, URL parameters, Cookie and Session objects to load and/or generate content, including providing any needed HTTP headers.

Content handlers should restrict the HTTP::Daemon::ClientConn response methods to send_response(), send_file_header(), send_error(), or send_redirect(), as HTTP::Daemon::Threaded::Socket provides automatic web logging for those methods.

Parameters:
$fd - HTTP::Daemon::Threaded::Socket object for the client
$request - HTTP::Request object
$uri - request URI
$params - hashref of URL parameters (key => value)
$session - (optional) a HTTP::Daemon::Threaded::Session object, if the application configured a SessionCache class, and if WebClient was able to recover an existing session from such a SessionCache.

putContent

putContent($fd, $request, $uri, $content, $session)

Put content. Uses input URI, URL parameters, Cookie and Session objects to process received content (via PUT request), including providing any needed HTTP headers.

Content handlers should restrict the HTTP::Daemon::ClientConn response methods to send_response(), send_file_response(), send_file_header(), send_error(), or send_redirect(), as HTTP::Daemon::Threaded::Socket provides automatic web logging for those methods.

Parameters:
$fd - HTTP::Daemon::Threaded::Socket object for the client
$request - HTTP::Request object
$uri - request URI
$content - decoded PUT content
$session - (optional) a HTTP::Daemon::Threaded::Session object, if the application configured a SessionCache class, and if WebClient was able to recover an existing session from such a SessionCache.

setCookie

setCookie($res, $session)

Set a response cookie. Convenience method to format and set a Set-Cookie header.

Parameters:
$res - HTTP::Response object
$session - HTTP::Daemon::Threaded::Session object from which to extract the cookie.
Returns:
this Content object

Generated by psichedoc on Mon Aug 28 09:45:39 2006