P5EEx-Blue-0.01

P5EEx::Blue::Context::HTTPHTML


NAME

P5EEx::Blue::Context::HTTPHTML - context in which we are currently running


SYNOPSIS

   # ... official way to get a Context object ...
   use P5EEx::Blue::P5EE;
   $context = P5EEx::Blue::P5EE->context();
   $config = $context->config();   # get the configuration
   $config->dispatch_events();     # dispatch events
   # ... alternative way (used internally) ...
   use P5EEx::Blue::Context::HTTPHTML;
   $context = P5EEx::Blue::Context::HTTPHTML->new();


DESCRIPTION

A Context class models the environment (aka ``context) in which the current process is running. For the P5EEx::Blue::Context::HTTPHTML class, this models any of the web application runtime environments which employ the HTTP protocol and produce HTML pages as output. This includes CGI, mod_perl, FastCGI, etc. The difference between these environments is not in the Context but in the implementation of the Request and Response objects.


Protected Methods:

The following methods are intended to be called by subclasses of the current class.


Protected Methods

These methods are considered protected because no class is ever supposed to call them. They may however be called by the context-specific drivers.

dispatch_events()

The dispatch_events() method is called by the CGI script in order to get the Context object rolling. It causes the program to process the CGI request, interpret and dispatch encoded events in the request and exit.

In concept, the dispatch_events() method would not return until all events for a Session were dispatched. However, the reality of the CGI context is that events associated with a Session occur in many different processes over different CGI requests. Therefore, the CGI Context implements the dispatch_events() method to return after processing all of the events of a single request, assuming that it will be called again when the next CGI request is received.

    * Signature: $context->dispatch_events()
    * Param:     void
    * Return:    void
    * Throws:    P5EEx::Blue::Exception
    * Since:     0.01
    Sample Usage:
    $context->dispatch_events();

request()

    * Signature: $context->request()
    * Param:     void
    * Return:    void
    * Throws:    P5EEx::Blue::Exception
    * Since:     0.01
    Sample Usage:
    $context->request();

The request() method gets the current Request being handled in the Context.

response()

    * Signature: $context->response()
    * Param:     void
    * Return:    void
    * Throws:    P5EEx::Blue::Exception
    * Since:     0.01
    Sample Usage:
    $context->response();

The response() method gets the current Request being handled in the Context.


Protected Methods

These methods are considered protected because no class is ever supposed to call them. They may however be called by the context-specific drivers.

display_current_widget()

    * Signature: $context->display_current_widget()
    * Param:     void
    * Return:    void
    * Throws:    P5EEx::Blue::Exception
    * Since:     0.01
    Sample Usage:
    $context->display_current_widget();

The display_current_widget() method searches the ``session widget'' for an attribute of ``current_widget'' and uses that as the name of the widget which should be displayed in the browser.

display_items()

The display_items() method takes an array of arguments and puts them all out to STDOUT with the appropriate headers.

    * Signature: $context->display_items(@items)
    * Param:     @items      @
    * Return:    void
    * Throws:    P5EEx::Blue::Exception
    * Since:     0.01
    Sample Usage:
    $context->display_items("Hello world!");


Public Methods:

log()

This method is inherited from P5EEx::Blue::Context.

user()

The user() method returns the username of the authenticated user. The special name, ``guest'', refers to the unauthenticated (anonymous) user.

    * Signature: $username = $self->user();
    * Param:  void
    * Return: string
    * Throws: <none>
    * Since:  0.01
    Sample Usage:
    $username = $context->user();

In a request/response environment, this turns out to be a convenience method which gets the authenticated user from the current Request object.

config()

This method is inherited from P5EEx::Blue::Context.


Public Methods: Debugging

dbg()

This method is inherited from P5EEx::Blue::Context.

dbgprint()

This method is inherited from P5EEx::Blue::Context.

dbglevel()

This method is inherited from P5EEx::Blue::Context.

dbgscope()

This method is inherited from P5EEx::Blue::Context.