IoServerContext class final

IoServerContext

Implementation of ServerContext for Jetleaf servers, providing:

  • Thread-safe storage for runtime attributes.
  • Configurable context path via environment properties.
  • Logging support specific to the server context.

This class acts as the central context for a running Jetleaf server, allowing server components to store and retrieve data, access logging.

Example usage:

final context = IoServerContext();
context.setAttribute("appName", "MyServer");
print(context.getAttribute("appName")); // "MyServer"
Implemented types

Constructors

IoServerContext()
Creates a new IoServerContext instance.

Properties

hashCode → int
The hash code for this object.
no setterinherited
log → Log
Returns the Log instance bound to this server context.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAttribute(String name) → Object?
Retrieves an arbitrary attribute previously stored in this context.
override
getAttributeNames() → Iterable<String>
Returns the list of all attribute names currently held in the context.
override
getContextPath() → String
Returns the base context path of the server (e.g., /, /api, /admin).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAttribute(String name) → void
Removes a previously stored attribute.
override
setAttribute(String name, Object value) → void
Stores a named attribute in the current context.
override
setEnvironment(Environment environment) → void
Sets the Environment that this component runs in.
toString() → String
A string representation of this object.
inherited

Operators

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