HttpMessage class abstract interface

Represents the base abstraction for HTTP messages, containing both headers and a potential body.

This interface is the common parent for both HttpInputMessage (used for requests) and HttpOutputMessage (used for responses). It provides the fundamental contract that all HTTP message types must implement, ensuring consistent access to message headers across different message contexts.

Responsibilities

  • Provides access to the HTTP HttpHeaders
  • Defines a common contract for input/output message structures
  • Serves as a foundation for high-level entities like RequestHttpBody and ResponseBody
  • Enables header manipulation and inspection regardless of message direction

Inheritance Hierarchy

HttpMessage (abstract)
├── HttpInputMessage (abstract) - for incoming messages
└── HttpOutputMessage (abstract) - for outgoing messages

Example

void logHeaders(HttpMessage message) {
  final headers = message.getHeaders();
  headers.forEach((name, values) {
    print('$name: ${values.join(", ")}');
  });
}

Design Notes

  • Part of JetLeaf's unified request/response abstraction model
  • Does not itself define a body; see HttpInputMessage and HttpOutputMessage for body access
  • Designed to be implemented by both client and server-side message types
Implementers

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

getHeaders() HttpHeaders
Returns the HTTP headers associated with this message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setHeaders(HttpHeaders headers) → void
Replaces the entire set of HTTP headers for this message.
toString() String
A string representation of this object.
inherited

Operators

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