static function initialise()
 {
     CompileTimeClassList::$lists = new haxe_ds_StringMap();
     $m = haxe_rtti_Meta::getType(_hx_qtype("CompileTimeClassList"));
     if ($m->classLists !== null) {
         $_g = 0;
         $_g1 = $m->classLists;
         while ($_g < $_g1->length) {
             $item = $_g1[$_g];
             ++$_g;
             $array = $item;
             $listID = $array[0];
             $list = new HList();
             $_g2 = 0;
             $_g3 = _hx_explode(",", $array[1]);
             while ($_g2 < $_g3->length) {
                 $typeName = $_g3[$_g2];
                 ++$_g2;
                 $type = Type::resolveClass($typeName);
                 if ($type !== null) {
                     $list->push($type);
                 }
                 unset($typeName, $type);
             }
             unset($_g3, $_g2);
             CompileTimeClassList::$lists->set($listID, $list);
             unset($listID, $list, $item, $array);
         }
     }
 }
 public function execute()
 {
     $uriParts = $this->context->actionContext->get_uriParts();
     $this->setBaseUri($uriParts);
     $params = $this->context->request->get_params();
     $method = $this->context->request->get_httpMethod();
     $this->context->actionContext->controller = $this;
     $this->context->actionContext->action = "execute";
     try {
         $this->context->actionContext->action = "showMessage";
         $this->context->actionContext->args = new _hx_array(array());
         $this->context->actionContext->get_uriParts()->splice(0, 0);
         $wrappingRequired = null;
         $i = haxe_rtti_Meta::getFields(_hx_qtype("ufront.app.DefaultUfrontController"))->showMessage->wrapResult[0];
         $wrappingRequired = $i;
         $result = $this->wrapResult($this->showMessage(), $wrappingRequired);
         $this->setContextActionResultWhenFinished($result);
         return $result;
         throw new HException(ufront_web_HttpError::pageNotFound(_hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 442, "className" => "ufront.app.DefaultUfrontController", "methodName" => "execute"))));
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         return ufront_core_SurpriseTools::asSurpriseError($e, "Uncaught error while executing " . Std::string($this->context->actionContext->controller) . "." . _hx_string_or_null($this->context->actionContext->action) . "()", _hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 445, "className" => "ufront.app.DefaultUfrontController", "methodName" => "execute")));
     }
 }
Exemplo n.º 3
0
 static function getFields($t)
 {
     $meta = haxe_rtti_Meta::getMeta($t);
     if ($meta === null || _hx_field($meta, "fields") === null) {
         return _hx_anonymous(array());
     } else {
         return $meta->fields;
     }
 }
 static function getApisInContext($context)
 {
     if (!php_Boot::$skip_constructor) {
         $apis = new _hx_array(array());
         $meta = haxe_rtti_Meta::getType($context);
         if ($meta->apiList !== null) {
             $_g = 0;
             $_g1 = $meta->apiList;
             while ($_g < $_g1->length) {
                 $apiName = $_g1[$_g];
                 ++$_g;
                 $api = Type::resolveClass($apiName);
                 if ($api !== null) {
                     $apis->push($api);
                 }
                 unset($apiName, $api);
             }
         }
         return $apis;
     }
 }
 public function executeApiCall($path, $args, $remotingContext, $actionContext)
 {
     if ($remotingContext->objects->exists($path[0]) === false) {
         throw new HException("Invalid path " . _hx_string_or_null($path->join(".")));
     }
     $actionContext->handler = $this;
     $actionContext->action = $path[$path->length - 1];
     $actionContext->controller = $remotingContext->objects->get($path[0])->obj;
     $actionContext->args = $args;
     $returnType = null;
     try {
         $fieldsMeta = haxe_rtti_Meta::getFields(Type::getClass($actionContext->controller));
         $actionMeta = Reflect::field($fieldsMeta, $actionContext->action);
         $returnType = $actionMeta->returnType[0];
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $returnType = 0;
     }
     $flags = $returnType;
     $result = $remotingContext->call($path, $args);
     if (($flags & 1 << ufront_api_ApiReturnType::$ARTFuture->index) !== 0) {
         return $result;
     } else {
         if (($flags & 1 << ufront_api_ApiReturnType::$ARTVoid->index) !== 0) {
             return tink_core__Future_Future_Impl_::sync(null);
         } else {
             return tink_core__Future_Future_Impl_::sync($result);
         }
     }
 }
 public function addClassToInfo($forClass, $info, $injected)
 {
     $meta = haxe_rtti_Meta::getType($forClass);
     $fields = $meta->rtti;
     if ($fields !== null) {
         $_g = 0;
         while ($_g < $fields->length) {
             $field = $fields[$_g];
             ++$_g;
             $name = $field[0];
             if ($injected->indexOf($name, null) > -1) {
                 continue;
             }
             $injected->push($name);
             if ($field->length === 3) {
                 $info->fields->push(new minject_point_PropertyInjectionPoint($name, $field[1], $field[2]));
             } else {
                 if ($name === "new") {
                     $info->ctor = new minject_point_ConstructorInjectionPoint($field->slice(2, null));
                 } else {
                     $orderStr = $field[1];
                     if ($orderStr === "") {
                         $info->fields->push(new minject_point_MethodInjectionPoint($name, $field->slice(2, null)));
                     } else {
                         $order = Std::parseInt($orderStr);
                         $info->fields->push(new minject_point_PostInjectionPoint($name, $field->slice(2, null), $order));
                         unset($order);
                     }
                     unset($orderStr);
                 }
             }
             unset($name, $field);
         }
     }
     $superClass = Type::getSuperClass($forClass);
     if ($superClass !== null) {
         $this->addClassToInfo($superClass, $info, $injected);
     }
 }
 static function getAsyncApi($syncApi)
 {
     $meta = haxe_rtti_Meta::getType($syncApi);
     if ($meta->asyncApi !== null) {
         $asyncApiName = $meta->asyncApi[0];
         if ($asyncApiName !== null) {
             return Type::resolveClass($asyncApiName);
         }
     }
     return null;
 }
Exemplo n.º 8
0
 public function execute()
 {
     $uriParts = $this->context->actionContext->get_uriParts();
     $this->setBaseUri($uriParts);
     $params = $this->context->request->get_params();
     $method = $this->context->request->get_httpMethod();
     $this->context->actionContext->controller = $this;
     $this->context->actionContext->action = "execute";
     try {
         if (0 === $uriParts->length) {
             $this->context->actionContext->action = "index";
             $this->context->actionContext->args = new _hx_array(array());
             $this->context->actionContext->get_uriParts()->splice(0, 0);
             $wrappingRequired = null;
             $i = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->index->wrapResult[0];
             $wrappingRequired = $i;
             $result = $this->wrapResult($this->index(), $wrappingRequired);
             $this->setContextActionResultWhenFinished($result);
             return $result;
         } else {
             if (1 === $uriParts->length && $uriParts[0] === "querystring") {
                 $this->context->actionContext->action = "queryString";
                 $this->context->actionContext->args = new _hx_array(array());
                 $this->context->actionContext->get_uriParts()->splice(0, 1);
                 $wrappingRequired1 = null;
                 $i1 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->queryString->wrapResult[0];
                 $wrappingRequired1 = $i1;
                 $result1 = $this->wrapResult($this->queryString(), $wrappingRequired1);
                 $this->setContextActionResultWhenFinished($result1);
                 return $result1;
             } else {
                 if (1 === $uriParts->length && $uriParts[0] === "poststring") {
                     $this->context->actionContext->action = "postString";
                     $this->context->actionContext->args = new _hx_array(array());
                     $this->context->actionContext->get_uriParts()->splice(0, 1);
                     $wrappingRequired2 = null;
                     $i2 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->postString->wrapResult[0];
                     $wrappingRequired2 = $i2;
                     $result2 = $this->wrapResult($this->postString(), $wrappingRequired2);
                     $this->setContextActionResultWhenFinished($result2);
                     return $result2;
                 } else {
                     if (1 === $uriParts->length && $uriParts[0] === "query") {
                         $this->context->actionContext->action = "query";
                         $this->context->actionContext->args = new _hx_array(array());
                         $this->context->actionContext->get_uriParts()->splice(0, 1);
                         $wrappingRequired3 = null;
                         $i3 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->query->wrapResult[0];
                         $wrappingRequired3 = $i3;
                         $result3 = $this->wrapResult($this->query(), $wrappingRequired3);
                         $this->setContextActionResultWhenFinished($result3);
                         return $result3;
                     } else {
                         if (1 === $uriParts->length && $uriParts[0] === "post") {
                             $this->context->actionContext->action = "post";
                             $this->context->actionContext->args = new _hx_array(array());
                             $this->context->actionContext->get_uriParts()->splice(0, 1);
                             $wrappingRequired4 = null;
                             $i4 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->post->wrapResult[0];
                             $wrappingRequired4 = $i4;
                             $result4 = $this->wrapResult($this->post(), $wrappingRequired4);
                             $this->setContextActionResultWhenFinished($result4);
                             return $result4;
                         } else {
                             if (1 === $uriParts->length && $uriParts[0] === "cookies") {
                                 $this->context->actionContext->action = "cookies";
                                 $this->context->actionContext->args = new _hx_array(array());
                                 $this->context->actionContext->get_uriParts()->splice(0, 1);
                                 $wrappingRequired5 = null;
                                 $i5 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->cookies->wrapResult[0];
                                 $wrappingRequired5 = $i5;
                                 $result5 = $this->wrapResult($this->cookies(), $wrappingRequired5);
                                 $this->setContextActionResultWhenFinished($result5);
                                 return $result5;
                             } else {
                                 if (1 === $uriParts->length && $uriParts[0] === "clientheaders") {
                                     $this->context->actionContext->action = "clientHeaders";
                                     $this->context->actionContext->args = new _hx_array(array());
                                     $this->context->actionContext->get_uriParts()->splice(0, 1);
                                     $wrappingRequired6 = null;
                                     $i6 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->clientHeaders->wrapResult[0];
                                     $wrappingRequired6 = $i6;
                                     $result6 = $this->wrapResult($this->clientHeaders(), $wrappingRequired6);
                                     $this->setContextActionResultWhenFinished($result6);
                                     return $result6;
                                 } else {
                                     if (1 === $uriParts->length && $uriParts[0] === "hostname") {
                                         $this->context->actionContext->action = "hostname";
                                         $this->context->actionContext->args = new _hx_array(array());
                                         $this->context->actionContext->get_uriParts()->splice(0, 1);
                                         $wrappingRequired7 = null;
                                         $i7 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->hostname->wrapResult[0];
                                         $wrappingRequired7 = $i7;
                                         $result7 = $this->wrapResult($this->hostname(), $wrappingRequired7);
                                         $this->setContextActionResultWhenFinished($result7);
                                         return $result7;
                                     } else {
                                         if (1 === $uriParts->length && $uriParts[0] === "clientip") {
                                             $this->context->actionContext->action = "clientIP";
                                             $this->context->actionContext->args = new _hx_array(array());
                                             $this->context->actionContext->get_uriParts()->splice(0, 1);
                                             $wrappingRequired8 = null;
                                             $i8 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->clientIP->wrapResult[0];
                                             $wrappingRequired8 = $i8;
                                             $result8 = $this->wrapResult($this->clientIP(), $wrappingRequired8);
                                             $this->setContextActionResultWhenFinished($result8);
                                             return $result8;
                                         } else {
                                             if (1 <= $uriParts->length && $uriParts[0] === "uri") {
                                                 $this->context->actionContext->action = "uri";
                                                 $this->context->actionContext->args = new _hx_array(array());
                                                 $this->context->actionContext->get_uriParts()->splice(0, 1);
                                                 $wrappingRequired9 = null;
                                                 $i9 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->uri->wrapResult[0];
                                                 $wrappingRequired9 = $i9;
                                                 $result9 = $this->wrapResult($this->uri(), $wrappingRequired9);
                                                 $this->setContextActionResultWhenFinished($result9);
                                                 return $result9;
                                             } else {
                                                 if (1 === $uriParts->length && $uriParts[0] === "httpmethod") {
                                                     $this->context->actionContext->action = "httpMethod";
                                                     $this->context->actionContext->args = new _hx_array(array());
                                                     $this->context->actionContext->get_uriParts()->splice(0, 1);
                                                     $wrappingRequired10 = null;
                                                     $i10 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->httpMethod->wrapResult[0];
                                                     $wrappingRequired10 = $i10;
                                                     $result10 = $this->wrapResult($this->httpMethod(), $wrappingRequired10);
                                                     $this->setContextActionResultWhenFinished($result10);
                                                     return $result10;
                                                 } else {
                                                     if (1 === $uriParts->length && $uriParts[0] === "scriptdirectory") {
                                                         $this->context->actionContext->action = "scriptDir";
                                                         $this->context->actionContext->args = new _hx_array(array());
                                                         $this->context->actionContext->get_uriParts()->splice(0, 1);
                                                         $wrappingRequired11 = null;
                                                         $i11 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->scriptDir->wrapResult[0];
                                                         $wrappingRequired11 = $i11;
                                                         $result11 = $this->wrapResult($this->scriptDir(), $wrappingRequired11);
                                                         $this->setContextActionResultWhenFinished($result11);
                                                         return $result11;
                                                     } else {
                                                         if (1 === $uriParts->length && $uriParts[0] === "authorization") {
                                                             $this->context->actionContext->action = "authorization";
                                                             $this->context->actionContext->args = new _hx_array(array());
                                                             $this->context->actionContext->get_uriParts()->splice(0, 1);
                                                             $wrappingRequired12 = null;
                                                             $i12 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->authorization->wrapResult[0];
                                                             $wrappingRequired12 = $i12;
                                                             $result12 = $this->wrapResult($this->authorization(), $wrappingRequired12);
                                                             $this->setContextActionResultWhenFinished($result12);
                                                             return $result12;
                                                         } else {
                                                             if (3 === $uriParts->length && $uriParts[0] === "testresponse" && strlen($uriParts[1]) > 0 && strlen($uriParts[2]) > 0) {
                                                                 $status = Std::parseInt($uriParts[1]);
                                                                 if ($status === null) {
                                                                     throw new HException(testsite_Routes_0($this, $method, $params, $status, $uriParts));
                                                                 }
                                                                 $charset = $uriParts[2];
                                                                 $_param_tmp_language = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "language");
                                                                 $_param_tmp_contentType = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "contentType");
                                                                 $_param_tmp_content = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "content");
                                                                 $_param_tmp_cookieName = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "cookieName");
                                                                 $_param_tmp_cookieVal = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "cookieVal");
                                                                 $args = _hx_anonymous(array("language" => $_param_tmp_language, "contentType" => $_param_tmp_contentType, "content" => $_param_tmp_content, "cookieName" => $_param_tmp_cookieName, "cookieVal" => $_param_tmp_cookieVal));
                                                                 $this->context->actionContext->action = "testResponse";
                                                                 $this->context->actionContext->args = new _hx_array(array($status, $charset, $args));
                                                                 $this->context->actionContext->get_uriParts()->splice(0, 3);
                                                                 $wrappingRequired13 = null;
                                                                 $i13 = haxe_rtti_Meta::getFields(_hx_qtype("testsite.Routes"))->testResponse->wrapResult[0];
                                                                 $wrappingRequired13 = $i13;
                                                                 $result13 = $this->wrapResult($this->testResponse($status, $charset, $args), $wrappingRequired13);
                                                                 $this->setContextActionResultWhenFinished($result13);
                                                                 return $result13;
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         throw new HException(ufront_web_HttpError::pageNotFound(_hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 442, "className" => "testsite.Routes", "methodName" => "execute"))));
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         return ufront_core_SurpriseTools::asSurpriseError($e, "Uncaught error while executing " . Std::string($this->context->actionContext->controller) . "." . _hx_string_or_null($this->context->actionContext->action) . "()", _hx_anonymous(array("fileName" => "ControllerMacros.hx", "lineNumber" => 445, "className" => "testsite.Routes", "methodName" => "execute")));
     }
 }