Gateway.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. define("AMFPHP_BASE", realpath(dirname(dirname(dirname(__FILE__)))) . "/");
  3. require_once(AMFPHP_BASE . "shared/app/BasicGateway.php");
  4. require_once(AMFPHP_BASE . "shared/util/MessageBody.php");
  5. require_once(AMFPHP_BASE . "shared/util/functions.php");
  6. require_once(AMFPHP_BASE . "json/app/Actions.php");
  7. class Gateway extends BasicGateway
  8. {
  9. function createBody()
  10. {
  11. $GLOBALS['amfphp']['encoding'] = 'json';
  12. $body = & new MessageBody();
  13. $uri = __setUri();
  14. $elements = explode('/json.php', $uri);
  15. if(strlen($elements[1]) == 0)
  16. {
  17. echo("The JSON gateway is installed correctly. Call like this: json.php/MyClazz.myMethod/arg1/arg2");
  18. exit();
  19. }
  20. $args = substr($elements[1], 1);
  21. $rawArgs = explode('/', $args);
  22. if(isset($GLOBALS['HTTP_RAW_POST_DATA']))
  23. {
  24. $rawArgs[] = $GLOBALS['HTTP_RAW_POST_DATA'];
  25. }
  26. $body->setValue($rawArgs);
  27. return $body;
  28. }
  29. /**
  30. * Create the chain of actions
  31. */
  32. function registerActionChain()
  33. {
  34. $this->actions['deserialization'] = 'deserializationAction';
  35. $this->actions['classLoader'] = 'classLoaderAction';
  36. $this->actions['security'] = 'securityAction';
  37. $this->actions['exec'] = 'executionAction';
  38. $this->actions['serialization'] = 'serializationAction';
  39. }
  40. }
  41. ?>