HTTP::Daemon::Threaded::Listener

SUMMARY: CONSTR | METHOD | DETAIL: CONSTR | METHOD

## Class HTTP::Daemon::Threaded::Listener

Inherits from:
  Thread::Apartment::MuxServer
  HTTP::Daemon::Threaded::Logable

Web network listener: accepts network connections, and routes them to WebClient objects to handle the web requests. Creates and maintains a pool of WebClient objects.

A threads::shared array is shared between this object and the WebClient objects so that WebClients can return themselves to the free list quickly; a future release may convert the freelist to a full object, in the event the allocate/free methods require a more complex process.

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(AptTimeout => value, Port => value, MaxClients => value, LogLevel => value, EventLogger => value, WebLogger => value, Handlers => value, UserAuth => value, SessionCache => value, InactivityTimer => value, ContentParams => value, DocRoot => value, ProductTokens => value, MediaTypes => value, SelectInterval => value)` Opens the HTTPD listener socket and creates its selector

Method Summary
`close()` Closes the listen socket and stops all the WebClient threads
`getListenInterval()` Get IO::Select() interval
`getSocket()` Return the listener socket
`get_simplex_methods()` Overrides Thread::Apartment::Server::get_simplex_methods()
`handleSocketError()` Deprecated. 1
`handleSocketEvent()` Handle listen socket events
`run()` Thread::Apartment::MuxServer::run() implementation
`setListenInterval($interval)` Set IO::Select() interval
`setLogLevel($level)` Set log level

Constructor Details

### new

    new(AptTimeout => value, Port => value, MaxClients => value, LogLevel => value, EventLogger => value, WebLogger => value, Handlers => value, UserAuth => value, SessionCache => value, InactivityTimer => value, ContentParams => value, DocRoot => value, ProductTokens => value, MediaTypes => value, SelectInterval => value)

  Opens the HTTPD listener socket and creates its selector. Creates a pool of HTTP::Daemon::Threaded::WebClient apartment threaded objects, based on the specified MaxClient parameter.

  Note that the following parameters are recognized by HTTP::Daemon::Threaded and/or HTTP::Daemon::Threaded::WebClient, but applications may supply additional parameter key/value pairs which will be provided to the constructor for any specified HTTP::Daemon::Threaded::ContentParams class.

  Parameters:
    `AptTimeout` => (optional) Thread::Apartment proxy return timeout
    `Port` => (optional) TCP listen port; default 80.
    `MaxClients` => (optional) max number of client handlers to spawn; default 5
    `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)
    `WebLogger` => (optional) Instance of a HTTP::Daemon::Threaded::Logger to receive web request notifications
    `Handlers` => (required) URI handler map; arrayref mapping URI regex's to handler package names
    `UserAuth` => (optional) instance of a subclass of HTTP::Daemon::Threaded::Auth (not yet supported)
    `SessionCache` => (optional) instance of a subclass of HTTP::Daemon::Threaded::SessionCache to be used to create/manage sessions
    `InactivityTimer` => (optional) number of seconds a WebClient waits before disconnecting an idle connection; default 10 minutes
    `ContentParams` => (optional) name of concrete implementation of HTTP::Daemon::Threaded::ContentParams
    `DocRoot` => (optional) root directory for default file based content handler
    `ProductTokens` => (optional) product token string to return to client; default is 'HTTP::Daemon::Threaded/'
    `MediaTypes` => (optional) hashref mapping 'Content-Type' specifications to file qualifier strings. Values may be either a single string literal, or
    `SelectInterval` => (optional) seconds to wait in select()'s on sockets. May be fractional; default 0.5
  Returns:
    HTTP::Daemon::Threaded object

Method Details

### close

    close()

  Closes the listen socket and stops all the WebClient threads.

  Simplex
  Returns:
    1

### getListenInterval

    getListenInterval()

  Get IO::Select() interval. Called when HTTP::Daemon::Threaded config info is requested.

  Returns:
    current listener interval

### getSocket

    getSocket()

  Return the listener socket.

  Returns:
    HTTP::Daemon::Threaded::Socket listen socket object

### get_simplex_methods

    get_simplex_methods()

  Overrides Thread::Apartment::Server::get_simplex_methods()

  Returns:
    hashref of simplex method names

### handleSocketError

    handleSocketError()

  Handle socket errors.

  Returns:
    undef

### handleSocketEvent

    handleSocketEvent()

  Handle listen socket events. Accepts a new connection request, allocates a WebClient to handle it, and passes the new socket to the WebClient

  Returns:
    1

### run

    run()

  Thread::Apartment::MuxServer::run() implementation.

  Returns:
    1

### setListenInterval

    setListenInterval($interval)

  Set IO::Select() interval. Called when HTTP::Daemon::Threaded select interval is updated.

  Simplex
  Parameters:
    `$interval` - new interval; fractional number of seconds
  Returns:
    1

### setLogLevel

    setLogLevel($level)

  Set log level. Called from WebClient when loglevel update is requested.

  Simplex
  Parameters:
    `$level` - new log level
  Returns:
    1

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