DefaultRestExecutor class final

A low-level HTTP client implementation for the JetLeaf REST framework that provides a configurable and extensible bridge to Dart’s HttpClient.

The DefaultRestExecutor class encapsulates connection management, timeouts, header handling, and compression policies through a provided RestConfig configuration object. It serves as the underlying transport mechanism for higher-level REST abstractions such as RestClient and RequestSpec.

Responsibilities

  • Opens HTTP connections using the configured RestConfig options.
  • Applies default headers from the provided HttpHeaders instance.
  • Enforces connection limits, compression policies, and timeouts.
  • Produces RestHttpRequest instances ready for execution.

Example

final ioConfig = RestConfig(
  connectionTimeout: Duration(seconds: 10),
  idleTimeout: Duration(seconds: 30),
  userAgent: 'JetLeafClient/1.0',
  encodingDecoder: DefaultEncodingDecoder(),
);

final defaultHeaders = HttpHeaders()
  ..add('Accept', 'application/json');

final client = DefaultRestExecutor(ioConfig, defaultHeaders);

final request = await client.createRequest(
  Uri.parse('https://api.example.com/data'),
  HttpMethod.GET,
);

final response = await request.execute();
print('Status: ${response.getStatus()}');

Integration

This client is the default implementation of RestExecutor in JetLeaf. It allows full control over socket-level options while maintaining compliance with JetLeaf’s request/response pipeline.

Implemented types

Constructors

DefaultRestExecutor(RestConfig _config, HttpHeaders _headers)
A low-level HTTP client implementation for the JetLeaf REST framework that provides a configurable and extensible bridge to Dart’s HttpClient.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Defines the primary abstraction for executing HTTP requests within the JetLeaf client-side ecosystem.
override
createRequest(Uri uri, HttpMethod method) Future<RestHttpRequest>
Creates and returns a new RestHttpRequest for the given uri and method.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited