Class AbstractService

Description

Base service class

This is the base class for JSRSService and AjaxService, which are classes that handle calls performed from Javascript code.

Located in /core/service/AbstractService.class.php (line 52)

PHP2Go
   |
   --AbstractService
Direct descendents
Class Description
AjaxService Handles AJAX remote function/method calls
JSRSService Handles JSRS requests
Variable Summary
Method Summary
bool acceptRequest ()
void handleRequest ()
void onError ()
void registerHandler (string|array $handler, [string $alias = NULL])
void registerObject (object &$object, [string $methodPrefix = ''])
bool sendResponse (mixed $response)
void setErrorHandling (bool $setting)
void setFallbackHandler (string|array $handler, [string $alias = NULL])
Variables
bool $errorHandling = FALSE (line 88)

Error handling flag

  • access: private
Callback $fallbackHandler = NULL (line 81)

Fallback handler

  • access: private
string $handlerId = NULL (line 67)

Requested handler ID

  • access: private
array $handlerParams = array() (line 74)

Request parameters

  • access: private
array $handlers = array() (line 60)

Registered handlers

  • access: private
Methods
Constructor AbstractService (line 95)

Class constructor

AbstractService AbstractService ()
acceptRequest (line 239)

Must be implemented by child classes

  • access: protected
bool acceptRequest ()

Redefined in descendants as:
handleRequest (line 201)

Triggers request handling and processing

Parses the request parameters. If the request is a valid request, this method tries to find a handler to handle the incoming request.

void handleRequest ()
onError (line 262)

Must be implemented by child classes

  • abstract:
void onError ()

Redefined in descendants as:
onInvalidHandler (line 260)

Must be implemented by child classes

  • abstract:
void onInvalidHandler ()

Redefined in descendants as:
onMissingHandler (line 258)

Must be implemented by child classes

  • abstract:
void onMissingHandler ()

Redefined in descendants as:
registerHandler (line 119)

Registers a new handler

The handler can be a procedural function, a class/method or an object/method pair (the last two represented by an array).

void registerHandler (string|array $handler, [string $alias = NULL])
  • string|array $handler: Handler spec
  • string $alias: Handler alias
registerObject (line 151)

Register methods of an object as handlers

A method prefix can be defined, so that only methods that respect this pattern will be recognized.

Example:

  1.  class MyHandler
  2.  {
  3.    function thisIsNotAHandler(}
  4.    function serviceDoThis(}
  5.    function serviceDoThat(}
  6.  }
  7.  $handler new MyHandler();
  8.  $service->registerObject($handler'service');

void registerObject (object &$object, [string $methodPrefix = ''])
  • object &$object: Object
  • string $methodPrefix: Method prefix
sendResponse (line 250)

Must be implemented by child classes

  • access: protected
bool sendResponse (mixed $response)
  • mixed $response: Response

Redefined in descendants as:
setErrorHandling (line 106)

Enables/disables error handling while calling service handlers

void setErrorHandling (bool $setting)
  • bool $setting: Flag value
setFallbackHandler (line 184)

Register a handler to be called when an invalid handler ID is requested

void setFallbackHandler (string|array $handler, [string $alias = NULL])
  • string|array $handler: Handler spec
  • string $alias: Handler alias

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:19:53 -0300 by phpDocumentor 1.3.2