Constants

BINARY BodyType

BodyType.BINARY
CONNECT → String

"CONNECT"
defaultAddress → String

"0.0.0.0"
defaultPort → int

8080
DELETE → String

"DELETE"
FORM BodyType

BodyType.FORM
GET → String

HTTP methods

"GET"

"HEAD"
JSON BodyType

BodyType.JSON
OPTIONS → String

"OPTIONS"
POST → String

"POST"
PUT → String

"PUT"
TEXT BodyType

BodyType.TEXT
TRACE → String

"TRACE"

Typedefs

DynamicHandler(Injector injector, Request request) → dynamic

An interceptor or error handler, programmatically created by a plugin.

DynamicRoute(Injector injector, Request request) → dynamic

A route programmatically created by a plugin.

ParamProvider(metadata, Type paramType, String handlerName, String paramName, Request request, Injector injector) → dynamic

A parameter provider is a function that can create parameters for routes, interceptors and error handlers.

RedstonePlugin(Manager manager) → dynamic

A plugin is a function which can dynamically add new features to an application.

ResponseProcessor(metadata, String handlerName, Object response, Injector injector) → dynamic

A response processor is a function which can transform values returned by routes.

RouteWrapper(metadata, Injector injector, Request request, DynamicRoute route(Injector injector, Request request)) → dynamic

A route wrapper created by a plugin.

Properties

chain Chain

Returns the current request chain

read-only
redstoneLogger → Logger

read-only
request Request

Returns the current request

read-only
response → Response

Returns the current response

read / write
router → Router

read-only
showErrorPage → bool

By default, redstone generates an error page whenever a response with status code less than 200, or greater or equal than 300, is returned. To prevent this behavior, set this flag to false.

read / write

Functions

abort(int statusCode) → Future<Response>

Creates a new response for statusCode. If there is an ErrorHandler registered for this status code, it will be invoked.

addModule(Module module) → void

Register a module for dependency injection.

addPlugin(RedstonePlugin plugin(Manager manager)) → void

Register a plugin.

addShelfMiddleware(Middleware middleware(Handler innerHandler(Request request))) → void

Register a Shelf Middleware.

dispatch(MockRequest request) → Future<MockHttpResponse>

Dispatch a request.

handleRequest(HttpRequest request) → Future

Handle a HttpRequest.

redirect(String url) → Response

Creates a new response with an 302 status code.

redstoneSetUp([List<Symbol> libraries, bool logSetUp = true]) → Future

Scan and initialize routes, interceptors and error handlers

redstoneTearDown() → void

Remove all modules, plugins, routes, interceptors and error handlers.

serveRequests(Stream<HttpRequest> requests) → Future

Serve a Stream of HttpRequests.

setShelfHandler(Handler handler(Request request)) → void

Register a Shelf Handler.

setupConsoleLog([Level level = Level.INFO]) → void

Setup a simple log handler, that output messages to console.

start({String address: defaultAddress, int port: defaultPort, bool autoCompress: false, bool shared: false, bool logSetUp: true, Map<Symbol, dynamic> secureOptions}) → Future<HttpServer>

Start the server.

Enums

BodyType

Content types

HandlerType

Handler types

Classes

AnnotatedType

ApplicationMetadata

Provides access for installed routes, interceptors, error handlers and groups that composes an application.

Attr

An annotation to define a request attribute.

Body

An annotation to define a target parameter.

Chain

A chain of handlers.

Credentials

User credentials (HTTP Basic Authentication)

DefaultRoute

An annotation to define a target which must be bound to the URL of its group.

DefaultRouteMetadata

Default route metadata information

DynamicMap

A Map that allows the use of the dot notation to access its values

ErrorHandler

An annotation to define error handlers.

ErrorHandlerMetadata

Error handler metadata information

ErrorResponse

An error response.

Group

An annotation to define groups.

GroupMetadata

Group metadata information

HandlerMetadata

The base metadata class for handlers

Ignore

Use this annotation to import a library without installing its handlers

Inject

An annotation to define a injectable dependency.

Install

An annotation to include handlers from other libraries

Interceptor

An annotation to define interceptors.

InterceptorMetadata

Interceptor metadata information

LibraryMetadata

Library metadata information

Manager

Allows to programmatically create routes, interceptors, error handlers, parameter providers and response processors.

MockHttpHeaders

MockHttpRequest

MockHttpResponse

MockHttpSession

A mock session, intended to be used with MockRequest.

MockRequest

A class to simulate requests in unit tests.

QueryParam

An annotation to define a target parameter.

Request

The request information and content.

RequestTarget

RequestTargetMetadata

ResponseProcessorMetadata

Route

An annotation to define targets.

RouteMetadata

Route metadata information

RouteWrapperMetadata

ServerMetadata

Metadata of the current application

Exceptions / Errors

PluginException

SetupException

An SetupException can be thrown during the setUp stage of Redstone