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);
     }
 }
 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 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"))));
 }
 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")))));
     }
 }
 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"))));
     }
 }