IoResponse class base

Represents an HTTP response within the JetLeaf I/O framework, providing a bridge between the high-level ServerHttpResponse abstraction and the underlying dart:io io.HttpResponse.

This class enables manipulation of response headers, status codes, body streaming, and other response-related metadata. It also maintains a reference to the originating IoRequest, which can be used for session management, context, and request-specific data.

Purpose

  • Provides access to the underlying io.HttpResponse for low-level operations.
  • Supports header caching and manipulation via _localHeaders.
  • Integrates with JetLeaf session handling for automatic session ID propagation.
  • Facilitates connection introspection via getConnection.

Example

final ioResponse = IoResponse(ioResp, ioReq);
ioResponse.setStatus(HttpStatus.OK);
ioResponse.getHeaders().setContentType('application/json');
await ioResponse.getBody().write(jsonEncode({'message': 'success'}));
Implemented types

Constructors

IoResponse(HttpResponse _response, IoRequest _request)
Represents an HTTP response within the JetLeaf I/O framework, providing a bridge between the high-level ServerHttpResponse abstraction and the underlying dart:io io.HttpResponse.

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

encodeRedirectUrl(String location) Future<String>
Encodes the given redirect URL for use in HTTP redirection.
override
getBody() → OutputStream
Returns the message body as an OutputStream.
override
getConnection() HttpConnectionInfo?
Returns connection information for this HTTP request.
getContentLength() int?
Returns the size of the HTTP request body in bytes, if known.
getHeaders() HttpHeaders
Returns the HTTP headers associated with this message.
override
getResponse() HttpResponse
Returns the underlying dart:io HttpResponse instance.
getStatus() HttpStatus?
Returns the current HTTP status code of this response.
override
isCommitted() bool
Indicates whether the response has already been committed to the client.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendRedirect(String encodedLocation) Future<void>
Sends an HTTP redirect to the client using the specified encoded URL.
override
setHeaders(HttpHeaders headers) → void
Replaces the entire set of HTTP headers for this message.
override
setReason(String message) → void
Sets the HTTP detailed reason for this response.
override
setStatus(HttpStatus httpStatus) → void
Sets the HTTP status code for this response.
override
toString() String
A string representation of this object.
inherited

Operators

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