Exemple #1
0
 /**
  * handles the request, executes service and flushes result to output stream.
  * nothing will happen unless this function is called! if the server was called
  * with GET and not GET parameters are set will flush smd directly
  *
  * @error 14213
  * @return void
  * @throws Xapp_Rpc_Fault
  */
 public final function handle()
 {
     xapp_debug('rpc server handler started', 'rpc');
     xapp_event('xapp.rpc.server.handle', array(&$this));
     if ($this->request()->isGet() && $this->request()->getParam('view') === 'rpc') {
         $this->response()->body($this->smd()->compile());
         $this->response()->flush();
     } else {
         if ($this->hasCalls()) {
             foreach ($this->_calls as $call) {
                 $this->execute($call);
             }
             $this->flush();
         } else {
             Xapp_Rpc_Fault::t("request is empty or does not contain any rpc action", array(1421301, -32600), XAPP_ERROR_IGNORE);
         }
     }
     xapp_debug('rpc server handler stopped', 'rpc');
 }
Exemple #2
0
 /**
  * run gateway validating all options and handle request by server first by calling server setup method
  * then handle and finally tearing down the server instance. nothing will happen unless this function is called!
  *
  * @error 14016
  * @return void
  */
 public final function run()
 {
     xapp_debug('rpc gateway running', 'rpc');
     xapp_event('xapp.rpc.gateway.run', array(&$this));
     $this->server()->setup();
     if ($this->server()->hasCalls()) {
         if (xapp_get_option(self::VALIDATE, $this)) {
             foreach (xapp_get_options($this) as $k => $v) {
                 $this->validate($k, $v);
             }
         }
     }
     $this->server()->handle();
     $this->server()->teardown();
     xapp_debug('rpc gateway shutting down', 'rpc');
 }
Exemple #3
0
 /**
  * xapp console shortcut function will tunnel all debug/console messages to Xapp_Console wrapper class which will handle
  * redirection to loaded php console class located in /ext directory such as FirePhp for firefox or ChromePhp for chrome
  * browser. Console logging is be default disabled. enable by overwritting global conf constant XAPP_CONF_CONSOLE with
  * either:
  * 1)   true = load default driver for FirePhp
  * 2)   instance of Xapp_Console = already instantiated wrapper class
  * 3)   string = defining the driver to load (e.g. firephp, chromephp)
  * 4)   null|false = to disable console logging
  * to route xapps default debug messages to php console use xapp conf constant XAPP_CONF_DEBUG_MODE = 4 or "console"
  * to rout all error messages into php console
  *
  * overwrite like:
  * <code>
  *      xapp_console($m = null, $l = null, $t = 'info', Array $o = array())
  *      {
  *          //your custom code here
  *      }
  * </code>
  *
  * @param null|mixed $m message - expects any value that can be send to console via the loaded driver
  * @param null|string $l label - expects an optional label to be display to explain log value
  * @param string $t type - expects the log type. see Xapp_Console for all log types
  * @param array $o options - expects further options. see loaded console driver for more
  * @return void
  */
 function xapp_console($m = null, $l = null, $t = 'info', array $o = array())
 {
     if (xapped('Xapp_Console') && (bool) xapp_conf(XAPP_CONF_CONSOLE)) {
         if (is_object(xapp_conf(XAPP_CONF_CONSOLE)) && xapp_conf(XAPP_CONF_CONSOLE) instanceof Xapp_Console) {
             xapp_conf(XAPP_CONF_CONSOLE)->log($m, $l, $t, $o);
         } else {
             if (xapp_conf(XAPP_CONF_CONSOLE) === true) {
                 Xapp_Console::instance('firephp')->log($m, $l, $t, $o);
             } else {
                 Xapp_Console::instance((string) xapp_conf(XAPP_CONF_CONSOLE))->log($m, $l, $t, $o);
             }
         }
     } else {
         xapp_debug($m);
     }
 }