コード例 #1
0
 static function asSurpriseTypedError($err, $msg = null, $p = null)
 {
     if ($msg === null) {
         $msg = "Failure: " . Std::string($err);
     }
     return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(ufront_web_HttpError::wrap($err, $msg, $p)));
 }
コード例 #2
0
 public function __construct($httpContext)
 {
     if (!php_Boot::$skip_constructor) {
         ufront_web_HttpError::throwIfNull($httpContext, "httpContext", _hx_anonymous(array("fileName" => "ActionContext.hx", "lineNumber" => 80, "className" => "ufront.web.context.ActionContext", "methodName" => "new")));
         $this->httpContext = $httpContext;
     }
 }
コード例 #3
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 {
         $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")));
     }
 }
コード例 #4
0
 public function requirePermissions($permissions)
 {
     if (null == $permissions) {
         throw new HException('null iterable');
     }
     $__hx__it = $permissions->iterator();
     while ($__hx__it->hasNext()) {
         unset($p);
         $p = $__hx__it->next();
         throw new HException(ufront_web_HttpError::authError(ufront_auth_AuthError::ANoPermission($p), _hx_anonymous(array("fileName" => "NobodyAuthHandler.hx", "lineNumber" => 32, "className" => "ufront.auth.NobodyAuthHandler", "methodName" => "requirePermissions"))));
     }
 }
コード例 #5
0
 public function flush()
 {
     if (!$this->_flushedStatus) {
         $this->_flushedStatus = true;
         php_Web::setReturnCode($this->status);
     }
     if (!$this->_flushedCookies) {
         $this->_flushedCookies = true;
         try {
             if (null == $this->_cookies) {
                 throw new HException('null iterable');
             }
             $__hx__it = $this->_cookies->iterator();
             while ($__hx__it->hasNext()) {
                 unset($cookie);
                 $cookie = $__hx__it->next();
                 php_Web::setCookie($cookie->name, $cookie->value, $cookie->expires, $cookie->domain, $cookie->path, $cookie->secure, $cookie->httpOnly);
             }
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $e = $_ex_;
             throw new HException(ufront_web_HttpError::internalServerError("Failed to set cookie on response", $e, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 34, "className" => "sys.ufront.web.context.HttpResponse", "methodName" => "flush"))));
         }
     }
     if (!$this->_flushedHeaders) {
         $this->_flushedHeaders = true;
         if (null == $this->_headers) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->_headers->keys();
         while ($__hx__it->hasNext()) {
             unset($key);
             $key = $__hx__it->next();
             $val = $this->_headers->get($key);
             if ($key === "Content-type" && null !== $this->charset && StringTools::startsWith($val, "text/")) {
                 $val .= "; charset=" . _hx_string_or_null($this->charset);
             }
             try {
                 header(_hx_string_or_null($key) . ": " . _hx_string_or_null($val));
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $e1 = $_ex_;
                 throw new HException(ufront_web_HttpError::internalServerError("Invalid header: \"" . _hx_string_or_null($key) . ": " . _hx_string_or_null($val) . "\", or output already sent", $e1, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 50, "className" => "sys.ufront.web.context.HttpResponse", "methodName" => "flush"))));
             }
             unset($val, $e1);
         }
     }
     if (!$this->_flushedContent) {
         $this->_flushedContent = true;
         Sys::hprint($this->_buff->b);
     }
 }
コード例 #6
0
 public function parseMultipart($onPart = null, $onData = null, $onEndPart = null)
 {
     $_g = $this;
     if (!$this->isMultipart()) {
         return ufront_core_SurpriseTools::success();
     }
     if ($this->_parsed) {
         throw new HException(ufront_web_HttpError::internalServerError("parseMultipart() has been called more than once.", null, _hx_anonymous(array("fileName" => "HttpRequest.hx", "lineNumber" => 93, "className" => "sys.ufront.web.context.HttpRequest", "methodName" => "parseMultipart"))));
     }
     $this->_parsed = true;
     if ($onPart === null) {
         $onPart = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_0"), 'execute');
     }
     if ($onData === null) {
         $onData = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_1"), 'execute');
     }
     if ($onEndPart === null) {
         $onEndPart = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_2"), 'execute');
     }
     $this->post = new haxe_ds_StringMap();
     $noParts = true;
     $isFile = false;
     $partName = null;
     $fileName = null;
     $currentContent = null;
     $callbackFutures = new _hx_array(array());
     $errors = new _hx_array(array());
     $processCallbackResult = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName), "sys_ufront_web_context_HttpRequest_3"), 'execute');
     $doEndOfPart = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_4"), 'execute');
     $doPart = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doEndOfPart, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_5"), 'execute');
     $doData = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doEndOfPart, &$doPart, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_6"), 'execute');
     try {
         sys_ufront_web_context__HttpRequest_WebOverride::parseMultipart($doPart, $doData);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $stack = haxe_CallStack::toString(haxe_CallStack::exceptionStack());
         $err1 = "Failed to parse multipart data: " . Std::string($e) . "\n" . _hx_string_or_null($stack);
         $errors->push($err1);
     }
     if ($noParts === false) {
         call_user_func($doEndOfPart);
     }
     if ($callbackFutures->length > 0) {
         return tink_core__Future_Future_Impl_::flatMap(tink_core__Future_Future_Impl_::ofMany($callbackFutures, null), array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doData, &$doEndOfPart, &$doPart, &$e, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_7"), 'execute'), null);
     } else {
         $data5 = tink_core_Outcome::Success(tink_core_Noise::$Noise);
         return tink_core__Future_Future_Impl_::sync($data5);
     }
 }
コード例 #7
0
 public function executeResult($context)
 {
     try {
         return $context->actionContext->actionResult->executeResult($context->actionContext);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $p_methodName = "executeResult";
         $p_lineNumber = -1;
         $p_fileName = "";
         $p_customParams = new _hx_array(array("actionContext"));
         $p_className = Type::getClassName(Type::getClass($context->actionContext));
         return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(ufront_web_HttpError::wrap($e, null, _hx_anonymous(array("fileName" => "MVCHandler.hx", "lineNumber" => 70, "className" => "ufront.web.MVCHandler", "methodName" => "executeResult")))));
     }
 }
コード例 #8
0
 public function indexOf($key)
 {
     if (!$this->__hash->exists($key)) {
         return -1;
     }
     $_g1 = 0;
     $_g = $this->__keys->length;
     while ($_g1 < $_g) {
         $i = $_g1++;
         if ($this->__keys[$i] === $key) {
             return $i;
         }
         unset($i);
     }
     throw new HException(ufront_web_HttpError::internalServerError("" . _hx_string_or_null($key) . " exists in hash but not in array", null, _hx_anonymous(array("fileName" => "OrderedStringMap.hx", "lineNumber" => 51, "className" => "ufront.core.OrderedStringMap", "methodName" => "indexOf"))));
 }
コード例 #9
0
 public function execute($httpContext)
 {
     ufront_web_HttpError::throwIfNull($httpContext, "httpContext", _hx_anonymous(array("fileName" => "UfrontApplication.hx", "lineNumber" => 173, "className" => "ufront.app.UfrontApplication", "methodName" => "execute")));
     if ($this->firstRun) {
         $this->initOnFirstExecute($httpContext);
     }
     if (null == $this->configuration->apis) {
         throw new HException('null iterable');
     }
     $__hx__it = $this->configuration->apis->iterator();
     while ($__hx__it->hasNext()) {
         unset($api);
         $api = $__hx__it->next();
         $httpContext->injector->mapRuntimeTypeOf($api, null)->_toSingleton($api);
         $asyncApi = ufront_api_UFAsyncApi::getAsyncApi($api);
         if ($asyncApi !== null) {
             $httpContext->injector->mapRuntimeTypeOf($asyncApi, null)->_toSingleton($asyncApi);
         }
         unset($asyncApi);
     }
     return parent::execute($httpContext);
 }
コード例 #10
0
 public function addUrlFilter($filter)
 {
     ufront_web_HttpError::throwIfNull($filter, "filter", _hx_anonymous(array("fileName" => "HttpApplication.hx", "lineNumber" => 565, "className" => "ufront.app.HttpApplication", "methodName" => "addUrlFilter")));
     $this->urlFilters->push($filter);
 }
コード例 #11
0
 public function _makeApiCall($method, $args, $flags, $pos = null)
 {
     if (!php_Boot::$skip_constructor) {
         $_g = $this;
         $remotingCallString = "" . _hx_string_or_null($this->className) . "." . _hx_string_or_null($method) . "(" . _hx_string_or_null($args->join(",")) . ")";
         $callApi = array(new _hx_lambda(array(&$_g, &$args, &$flags, &$method, &$pos, &$remotingCallString), "ufront_api_UFAsyncApi_0"), 'execute');
         $returnError = array(new _hx_lambda(array(&$_g, &$args, &$callApi, &$flags, &$method, &$pos, &$remotingCallString), "ufront_api_UFAsyncApi_1"), 'execute');
         if (($flags & 1 << ufront_api_ApiReturnType::$ARTVoid->index) !== 0) {
             try {
                 call_user_func($callApi);
                 return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(null));
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $e1 = $_ex_;
                 return call_user_func_array($returnError, array($e1));
             }
         } else {
             if (($flags & 1 << ufront_api_ApiReturnType::$ARTFuture->index) !== 0 && ($flags & 1 << ufront_api_ApiReturnType::$ARTOutcome->index) !== 0) {
                 try {
                     $surprise = call_user_func($callApi);
                     return tink_core__Future_Future_Impl_::map($surprise, array(new _hx_lambda(array(&$_g, &$args, &$callApi, &$flags, &$method, &$pos, &$remotingCallString, &$returnError, &$surprise), "ufront_api_UFAsyncApi_2"), 'execute'), null);
                 } catch (Exception $__hx__e) {
                     $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                     $e2 = $_ex_;
                     return call_user_func_array($returnError, array($e2));
                 }
             } else {
                 if (($flags & 1 << ufront_api_ApiReturnType::$ARTFuture->index) !== 0) {
                     try {
                         $future = call_user_func($callApi);
                         return tink_core__Future_Future_Impl_::map($future, array(new _hx_lambda(array(&$_g, &$args, &$callApi, &$flags, &$future, &$method, &$pos, &$remotingCallString, &$returnError), "ufront_api_UFAsyncApi_3"), 'execute'), null);
                     } catch (Exception $__hx__e) {
                         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                         $e3 = $_ex_;
                         return call_user_func_array($returnError, array($e3));
                     }
                 } else {
                     if (($flags & 1 << ufront_api_ApiReturnType::$ARTOutcome->index) !== 0) {
                         try {
                             $outcome = call_user_func($callApi);
                             switch ($outcome->index) {
                                 case 0:
                                     $data2 = _hx_deref($outcome)->params[0];
                                     return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success($data2));
                                     break;
                                 case 1:
                                     $err1 = _hx_deref($outcome)->params[0];
                                     return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(ufront_web_HttpError::remotingError(ufront_remoting_RemotingError::RApiFailure($remotingCallString, $err1), $pos)));
                                     break;
                             }
                         } catch (Exception $__hx__e) {
                             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                             $e4 = $_ex_;
                             return call_user_func_array($returnError, array($e4));
                         }
                     } else {
                         try {
                             $result1 = call_user_func($callApi);
                             return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success($result1));
                         } catch (Exception $__hx__e) {
                             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                             $e5 = $_ex_;
                             return call_user_func_array($returnError, array($e5));
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #12
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")));
     }
 }
コード例 #13
0
 public function parseMultipart($onPart = null, $onData = null, $onEndPart = null)
 {
     throw new HException(ufront_web_HttpError::abstractMethod(_hx_anonymous(array("fileName" => "HttpRequest.hx", "lineNumber" => 272, "className" => "ufront.web.context.HttpRequest", "methodName" => "parseMultipart"))));
 }
コード例 #14
0
 public function setHeader($name, $value)
 {
     ufront_web_HttpError::throwIfNull($name, null, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 201, "className" => "ufront.web.context.HttpResponse", "methodName" => "setHeader")));
     ufront_web_HttpError::throwIfNull($value, null, _hx_anonymous(array("fileName" => "HttpResponse.hx", "lineNumber" => 202, "className" => "ufront.web.context.HttpResponse", "methodName" => "setHeader")));
     $this->_headers->set($name, $value);
 }
コード例 #15
0
function ufront_web_upload_TmpFileUploadMiddleware_3(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onEndPart, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath, $result)
{
    switch ($result->index) {
        case 0:
            $s = _hx_deref($result)->params[0];
            return tink_core_Outcome::Success($s);
            break;
        case 1:
            $f = _hx_deref($result)->params[0];
            return tink_core_Outcome::Failure(ufront_web_HttpError::wrap($f, null, _hx_anonymous(array("fileName" => "TmpFileUploadMiddleware.hx", "lineNumber" => 101, "className" => "ufront.web.upload.TmpFileUploadMiddleware", "methodName" => "requestIn"))));
            break;
    }
}
コード例 #16
0
 public function execute()
 {
     if (!php_Boot::$skip_constructor) {
         return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(ufront_web_HttpError::internalServerError("Field execute() in ufront.web.Controller is an abstract method, please override it in " . _hx_string_or_null($this->toString()) . " ", null, _hx_anonymous(array("fileName" => "Controller.hx", "lineNumber" => 206, "className" => "ufront.web.Controller", "methodName" => "execute")))));
     }
 }
コード例 #17
0
 public function checkStarted($pos = null)
 {
     if (!$this->started) {
         throw new HException(ufront_web_HttpError::internalServerError("Trying to access session data before init() has been run", null, _hx_anonymous(array("fileName" => "FileSession.hx", "lineNumber" => 497, "className" => "ufront.web.session.FileSession", "methodName" => "checkStarted"))));
     }
 }
コード例 #18
0
 public function __construct($request, $response, $appInjector = null, $session = null, $auth = null, $urlFilters = null, $relativeContentDir = null)
 {
     if (!php_Boot::$skip_constructor) {
         if ($relativeContentDir === null) {
             $relativeContentDir = "uf-content";
         }
         ufront_web_HttpError::throwIfNull($response, null, _hx_anonymous(array("fileName" => "HttpContext.hx", "lineNumber" => 214, "className" => "ufront.web.context.HttpContext", "methodName" => "new")));
         ufront_web_HttpError::throwIfNull($request, null, _hx_anonymous(array("fileName" => "HttpContext.hx", "lineNumber" => 215, "className" => "ufront.web.context.HttpContext", "methodName" => "new")));
         $this->request = $request;
         $this->response = $response;
         if ($urlFilters !== null) {
             $this->urlFilters = $urlFilters;
         } else {
             $this->urlFilters = new _hx_array(array());
         }
         $this->_relativeContentDir = $relativeContentDir;
         $this->actionContext = new ufront_web_context_ActionContext($this);
         $this->messages = new _hx_array(array());
         $this->completion = 0;
         if ($appInjector !== null) {
             $this->injector = $appInjector->createChildInjector();
         } else {
             $this->injector = new minject_Injector(null);
         }
         $this->injector->mapType("ufront.web.context.HttpContext", null, null)->toValue($this);
         $this->injector->mapType("ufront.web.context.HttpRequest", null, null)->toValue($request);
         $this->injector->mapType("ufront.web.context.HttpResponse", null, null)->toValue($response);
         $this->injector->mapType("ufront.web.context.ActionContext", null, null)->toValue($this->actionContext);
         $this->injector->mapType("ufront.log.MessageList", null, null)->toValue(new ufront_log_MessageList($this->messages, null));
         $this->injector->mapType("minject.Injector", null, null)->toValue($this->injector);
         if ($session !== null) {
             $this->session = $session;
         }
         if ($this->session === null) {
             try {
                 $this->session = $this->injector->getValueForType("ufront.web.session.UFHttpSession", null);
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $e = $_ex_;
                 $msg = "Failed to load UFHttpSession: " . Std::string($e) . ". Using VoidSession instead." . _hx_string_or_null(haxe_CallStack::toString(haxe_CallStack::exceptionStack()));
                 $this->messages->push(_hx_anonymous(array("msg" => $msg, "pos" => _hx_anonymous(array("fileName" => "HttpContext.hx", "lineNumber" => 236, "className" => "ufront.web.context.HttpContext", "methodName" => "new")), "type" => ufront_log_MessageType::$MLog)));
             }
         }
         if ($this->session === null) {
             $this->session = new ufront_web_session_VoidSession();
         }
         $this->injector->mapType("ufront.web.session.UFHttpSession", null, null)->toValue($this->session);
         $this->injector->mapRuntimeTypeOf($this->session, null)->toValue($this->session);
         if ($auth !== null) {
             $this->auth = $auth;
         }
         if ($this->auth === null) {
             try {
                 $this->auth = $this->injector->getValueForType("ufront.auth.UFAuthHandler", null);
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $e1 = $_ex_;
                 $msg1 = "Failed to load UFAuthHandler: " . Std::string($e1) . ". Using NobodyAuthHandler instead." . _hx_string_or_null(haxe_CallStack::toString(haxe_CallStack::exceptionStack()));
                 $this->messages->push(_hx_anonymous(array("msg" => $msg1, "pos" => _hx_anonymous(array("fileName" => "HttpContext.hx", "lineNumber" => 244, "className" => "ufront.web.context.HttpContext", "methodName" => "new")), "type" => ufront_log_MessageType::$MLog)));
             }
         }
         if ($this->auth === null) {
             $this->auth = new ufront_auth_NobodyAuthHandler();
         }
         $this->injector->mapType("ufront.auth.UFAuthHandler", null, null)->toValue($this->auth);
         $this->injector->mapRuntimeTypeOf($this->auth, null)->toValue($this->auth);
     }
 }