Dart API Referencedart:ioHttpRequest

HttpRequest abstract class

Http request delivered to the HTTP server callback.

abstract class HttpRequest {
  /**
   * Returns the content length of the request body. If the size of
   * the request body is not known in advance this -1.
   */
  int get contentLength;

  /**
   * Returns the persistent connection state signaled by the client.
   */
  bool get persistentConnection;

  /**
   * Returns the method for the request.
   */
  String get method;

  /**
   * Returns the URI for the request.
   */
  String get uri;

  /**
   * Returns the path part of the URI.
   */
  String get path;

  /**
   * Returns the query string.
   */
  String get queryString;

  /**
   * Returns the parsed query string.
   */
  Map<String, String> get queryParameters;

  /**
   * Returns the request headers.
   */
  HttpHeaders get headers;

  /**
   * Returns the cookies in the request (from the Cookie headers).
   */
  List<Cookie> get cookies;

  /**
   * Returns, or initialize, a session for the given request. If the session is
   * being initialized by this call, [init] will be called with the
   * newly create session. Here the [:HttpSession.data:] field can be set, if
   * needed.
   * See [:HttpServer.sessionTimeout:] on how to change default timeout.
   */
  HttpSession session([init(HttpSession session)]);

  /**
   * Returns the input stream for the request. This is used to read
   * the request data.
   */
  InputStream get inputStream;

  /**
   * Returns the HTTP protocol version used in the request. This will
   * be "1.0" or "1.1".
   */
  String get protocolVersion;

  /**
   * Get information about the client connection. Returns [null] if the socket
   * isn't available.
   */
  HttpConnectionInfo get connectionInfo;
}

Properties

final HttpConnectionInfo connectionInfo #

Get information about the client connection. Returns null if the socket isn't available.

HttpConnectionInfo get connectionInfo;

final int contentLength #

Returns the content length of the request body. If the size of the request body is not known in advance this -1.

int get contentLength;

final List<Cookie> cookies #

Returns the cookies in the request (from the Cookie headers).

List<Cookie> get cookies;

final HttpHeaders headers #

Returns the request headers.

HttpHeaders get headers;

final InputStream inputStream #

Returns the input stream for the request. This is used to read the request data.

InputStream get inputStream;

final String method #

Returns the method for the request.

String get method;

final String path #

Returns the path part of the URI.

String get path;

final bool persistentConnection #

Returns the persistent connection state signaled by the client.

bool get persistentConnection;

final String protocolVersion #

Returns the HTTP protocol version used in the request. This will be "1.0" or "1.1".

String get protocolVersion;

final Map<String, String> queryParameters #

Returns the parsed query string.

Map<String, String> get queryParameters;

final String queryString #

Returns the query string.

String get queryString;

final String uri #

Returns the URI for the request.

String get uri;

Methods

HttpSession session([init(HttpSession session)]) #

Returns, or initialize, a session for the given request. If the session is being initialized by this call, init will be called with the newly create session. Here the HttpSession.data field can be set, if needed. See HttpServer.sessionTimeout on how to change default timeout.

HttpSession session([init(HttpSession session)]);