static function errorStackItems($stack)
 {
     $arr = new _hx_array(array());
     $stack->pop();
     $stack = $stack->slice(2, null);
     $arr1 = _hx_explode("\n", haxe_CallStack::toString($stack));
     return $arr1;
 }
 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);
     }
 }
function ufront_api_UFAsyncApi_1(&$_g, &$args, &$callApi, &$flags, &$method, &$pos, &$remotingCallString, $e)
{
    $stack = haxe_CallStack::toString(haxe_CallStack::exceptionStack());
    $remotingError = ufront_remoting_RemotingError::RServerSideException($remotingCallString, $e, $stack);
    return ufront_core_SurpriseTools::asBadSurprise(ufront_web_HttpError::remotingError($remotingError, $pos));
}
 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);
     }
 }