public function __construct() { if (!php_Boot::$skip_constructor) { $_g = $this; $this->{"list"} = new _hx_array(array()); $this->future = tink_core__Future_Future_Impl_::_new(array(new _hx_lambda(array(&$_g), "tink_core_FutureTrigger_0"), 'execute')); } }
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"))))); } }
public function getTemplateString($viewRelativePath) { $fullPath = _hx_string_or_null($this->get_viewDirectory()) . _hx_string_or_null($viewRelativePath); try { if (file_exists($fullPath)) { return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(haxe_ds_Option::Some(sys_io_File::getContent($fullPath)))); } else { return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(haxe_ds_Option::$None)); } } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; return $e->asSurpriseError("Failed to load template " . _hx_string_or_null($viewRelativePath)); } }
public function process($onData, $partSize = null) { try { if ($partSize === null) { $partSize = 8192; } $doneTrigger = new tink_core_FutureTrigger(); $fh = sys_io_File::read($this->tmpFileName, null); $pos = 0; $readNext = null; $readNext1 = null; $readNext1 = array(new _hx_lambda(array(&$doneTrigger, &$fh, &$onData, &$partSize, &$pos, &$readNext, &$readNext1), "ufront_web_upload_TmpFileUpload_0"), 'execute'); $readNext = $readNext1; call_user_func($readNext); return $doneTrigger->future; } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e1 = $_ex_; $data = tink_core_Outcome::Failure(tink_core_TypedError::withData(null, "Error during TmpFileUpload.process()", $e1, _hx_anonymous(array("fileName" => "TmpFileUpload.hx", "lineNumber" => 148, "className" => "ufront.web.upload.TmpFileUpload", "methodName" => "process")))); return tink_core__Future_Future_Impl_::sync($data); } }
public function requestIn($ctx) { $_g = $this; if (strtolower($ctx->request->get_httpMethod()) === "post" && $ctx->request->isMultipart()) { $file = null; $postName = null; $origFileName = null; $size = 0; $tmpFilePath = null; $dateStr = DateTools::format(Date::now(), "%Y%m%d-%H%M"); $dir = _hx_string_or_null($ctx->get_contentDirectory()) . _hx_string_or_null(haxe_io_Path::addTrailingSlash(ufront_web_upload_TmpFileUploadMiddleware::$subDir)); $path = haxe_io_Path::removeTrailingSlashes($dir); $path1 = haxe_io_Path::addTrailingSlash($path); $_p = null; $parts = new _hx_array(array()); while ($path1 !== ($_p = haxe_io_Path::directory($path1))) { $parts->unshift($path1); $path1 = $_p; } $_g1 = 0; while ($_g1 < $parts->length) { $part = $parts[$_g1]; ++$_g1; if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) { @mkdir($part, 493); } unset($part); } $onPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_0"), 'execute'); $onData = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_1"), 'execute'); $onEndPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_2"), 'execute'); return tink_core__Future_Future_Impl_::map($ctx->request->parseMultipart($onPart, $onData, $onEndPart), array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onEndPart, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_3"), 'execute'), null); } else { return ufront_core_SurpriseTools::success(); } }
public function executeResult($actionContext) { $_g = $this; return tink_core__Future_Future_Impl_::_tryMap($this->originalResult->executeResult($actionContext), array(new _hx_lambda(array(&$_g, &$actionContext), "ufront_web_result_CallJavascriptResult_0"), 'execute')); }
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); } }
public function wrapResultOrError($surprise) { return tink_core__Future_Future_Impl_::map($surprise, array(new _hx_lambda(array(&$surprise), "ufront_web_Controller_1"), 'execute'), null); }
public function handleError($err, $ctx, $doneTrigger) { $_g = $this; if (!(($ctx->completion & 1 << ufront_web_context_RequestCompletion::$CErrorHandlersTriggered->index) !== 0)) { $ctx->completion |= 1 << ufront_web_context_RequestCompletion::$CErrorHandlersTriggered->index; $errHandlerModules = $this->errorHandlers->map(array(new _hx_lambda(array(&$_g, &$ctx, &$doneTrigger, &$err), "ufront_app_HttpApplication_10"), 'execute')); $resMidModules = $this->responseMiddleware->map(array(new _hx_lambda(array(&$_g, &$ctx, &$doneTrigger, &$err, &$errHandlerModules), "ufront_app_HttpApplication_11"), 'execute')); $logHandModules = $this->logHandlers->map(array(new _hx_lambda(array(&$_g, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$resMidModules), "ufront_app_HttpApplication_12"), 'execute')); $allDone = tink_core__Future_Future_Impl_::_tryFailingFlatMap(tink_core__Future_Future_Impl_::_tryFailingFlatMap($this->executeModules($errHandlerModules, $ctx, ufront_web_context_RequestCompletion::$CErrorHandlersComplete), array(new _hx_lambda(array(&$_g, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$logHandModules, &$resMidModules), "ufront_app_HttpApplication_13"), 'execute')), array(new _hx_lambda(array(&$_g, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$logHandModules, &$resMidModules), "ufront_app_HttpApplication_14"), 'execute')); $callback = null; $f3 = null; $f4 = isset($doneTrigger->trigger) ? $doneTrigger->trigger : array($doneTrigger, "trigger"); $a13 = tink_core_Outcome::Failure($err); $f3 = array(new _hx_lambda(array(&$_g, &$a13, &$allDone, &$callback, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$f3, &$f4, &$logHandModules, &$resMidModules), "ufront_app_HttpApplication_15"), 'execute'); $callback = array(new _hx_lambda(array(&$_g, &$allDone, &$callback, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$f3, &$logHandModules, &$resMidModules), "ufront_app_HttpApplication_16"), 'execute'); $allDone($callback); } else { $msg = "You had an error after your error handler had already run. Last active module: " . _hx_string_or_null($this->currentModule->className) . "." . _hx_string_or_null($this->currentModule->methodName); Sys::println($msg); Sys::println("Error Data: " . Std::string($err->data)); $err->throwSelf(); } }
public function commitSession() { if ($this->session !== null) { return $this->session->commit(); } else { return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(tink_core_Noise::$Noise)); } }
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)); } } } } } } }
static function useFallback($s, $fallback) { return tink_core__Future_Future_Impl_::map($s, array(new _hx_lambda(array(&$fallback, &$s), "ufront_core_SurpriseTools_3"), 'execute'), null); }
static function _map($f, $map) { return tink_core__Future_Future_Impl_::map($f, $map, null); }
static function asFuture($data) { return tink_core__Future_Future_Impl_::sync($data); }
public function commit() { return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Success(tink_core_Noise::$Noise)); }
public function commit() { if ($this->sessionID === null && $this->sessionData !== null) { $this->regenerateID(); } return tink_core__Future_Future_Impl_::_tryFailingFlatMap(tink_core__Future_Future_Impl_::_tryFailingFlatMap(tink_core__Future_Future_Impl_::_tryFailingFlatMap($this->doRegenerateID(), isset($this->doSaveSessionContent) ? $this->doSaveSessionContent : array($this, "doSaveSessionContent")), isset($this->doSetExpiry) ? $this->doSetExpiry : array($this, "doSetExpiry")), isset($this->doCloseSession) ? $this->doCloseSession : array($this, "doCloseSession")); }
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 getTemplateString($path) { return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(new tink_core_TypedError(null, "Attempting to fetch template " . _hx_string_or_null($path) . " with UFViewEngine. This is an abstract class, you must use one of the ViewEngine implementations.", _hx_anonymous(array("fileName" => "UFViewEngine.hx", "lineNumber" => 208, "className" => "ufront.view.UFViewEngine", "methodName" => "getTemplateString"))))); }