HttpEndpoint class

Used for creating HTTP endpoints. An endpoint is a URL, at which a given service can be accessed by a client.

Configuration parameters

Parameters to pass to the configure method for component configuration:

  • connection(s) - the connection resolver's connections:
    • 'connection.discovery_key' - the key to use for connection resolving in a discovery service;
    • 'connection.protocol' - the connection's protocol;
    • 'connection.host' - the target host;
    • 'connection.port' - the target port;
    • 'connection.uri' - the target URI.
  • credential - the HTTPS credentials:
    • 'credential.ssl_key_file' - the SSL private key in PEM
    • 'credential.ssl_crt_file' - the SSL certificate in PEM
    • 'credential.ssl_ca_file' - the certificate authorities (root cerfiticates) in PEM

References

A logger, counters, and a connection resolver can be referenced by passing the following references to the object's setReferences method:

  • logger: '\*:logger:\*:\*:1.0';
  • counters: '\*:counters:\*:\*:1.0';
  • discovery: '\*:discovery:\*:\*:1.0' (for the connection resolver).

Examples

public MyMethod(ConfigParams _config, IReferences _references) {
    var endpoint = HttpEndpoint();
    if (config != null)
        endpoint.configure(_config);
    if (references)
        endpoint.setReferences(references);
    ...

    _endpoint.open(correlationId)
    _opened = true;

    ...
}
Implemented types

Constructors

HttpEndpoint()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

close(String correlationId) Future
Closes this endpoint and the REST server (service) that was opened earlier. [...]
override
configure(ConfigParams config) → void
Configures this HttpEndpoint using the given configuration parameters. [...]
override
isOpen() bool
Returns whether or not this endpoint is open with an actively listening REST server.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
open(String correlationId) Future
Opens a connection using the parameters resolved by the referenced connection resolver and creates a REST server (service) using the set options and parameters. [...]
override
register(IRegisterable registration) → void
Registers a registerable object for dynamic endpoint discovery. [...]
registerInterceptor(String route, Future action(RequestContext req, ResponseContext res)) → void
Registers a middleware action for the given route. [...]
registerRoute(String method, String route, Schema schema, dynamic action(RequestContext req, ResponseContext res)) → void
Registers an action in this objects REST server (service) by the given method and route. [...]
registerRouteWithAuth(String method, String route, Schema schema, dynamic authorize(RequestContext req, ResponseContext res, dynamic next()), dynamic action(RequestContext req, ResponseContext res)) → void
Registers an action with authorization in this objects REST server (service) by the given method and route. [...]
setReferences(IReferences references) → void
Sets references to this endpoint's logger, counters, and connection resolver. [...]
override
toString() String
Returns a string representation of this object.
inherited
unregister(IRegisterable registration) → void
Unregisters a registerable object, so that it is no longer used in dynamic endpoint discovery. [...]

Operators

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