///
///
import { IApplication } from "./core";
import * as http from "http";
import * as url from "url";
import { RouteContext } from "./route-context";
import * as bodyParser from "./body-parser";
import * as contentType from "content-type";
export declare class Context {
app: IApplication;
req: http.IncomingMessage;
res: http.ServerResponse;
items: Map;
requestParser: bodyParser.Parser;
private _contentType;
private _url;
private _ipAddresses;
private _routeContext;
private _bodyParseTask;
constructor(app: IApplication, req: http.IncomingMessage, res: http.ServerResponse, requestParser?: bodyParser.Parser);
getItem(key: string): T;
setItem(key: string, value: T): void;
hasItem(key: string): boolean;
getUrl(): url.Url;
getRouteContext(): RouteContext;
getRouteParams(): any;
getHttpMethod(): string;
getRequestStream(): http.IncomingMessage;
getResponseStream(): http.ServerResponse;
getRequestBody(parser?: bodyParser.Parser): Promise;
getContentType(): contentType.MediaType;
getClientIpAddress(): string;
getUpstreamIpAddresses(): string[];
getHost(): string;
getProtocol(): string;
isEncrypted(): boolean;
setHeader(key: string, value: string, replace?: boolean): boolean;
setHeaders(headers: any): void;
appendHeaderValue(key: string, value: string, forceAppend?: boolean): void;
removeHeaderValue(key: string, value: string, removeHeaderIfEmpty?: boolean): void;
setContentType(value: string, force?: boolean): void;
setStatus(code: number, message?: string): void;
sendStatus(code: number, message?: string, headers?: any): void;
send(body: any, headers?: any, code?: number): void;
sendText(text: string): void;
sendAsJson(data: any, replacer?: (key: string, value: any) => any, spaces?: string | number): void;
sendNoContent(headers?: any): void;
sendResetContent(headers?: any): void;
sendBadRequest(body: any, headers?: any): void;
sendNotFound(reason?: string, headers?: any): void;
sendForbidden(reason: any, headers?: any): void;
sendMethodNotAllowed(allowedMethods: string[] | string, reason?: string, headers?: any): void;
throw(error: Error): never;
throw(status: number, error: Error): never;
throw(status: number, msg?: string): never;
}
export declare function contextFactory(app: IApplication, req: http.IncomingMessage, res: http.ServerResponse, parser?: bodyParser.Parser): Context;