A web server application that can route requests to handler functions or annotated controllers, and serve static assets.

no subtypes hierarchy

Initializer
Application(String address = ..., Integer port = ..., <Package|{Object*}>[2]? controllers = null, String[2]? assets = null, String? modulesPath = null, Filter[] filters = [], TemplateRenderer<T>? renderer = null, Transformer[] transformers = [])
Parameters:
  • address = "0.0.0.0"

    The address or hostname on which the HTTP server will be bound.

  • port = 8080

    The port on which the server will listen.

  • controllers = null

    Additional controllers in which route()s will be scanned, that will be associated to the given context root.

    If a package is provided, gyokuro will look for classes and objects annotated with the controller() annotation and instantiate them automatically.

    If a stream of Objects is provided, gyokuro will look for existing instances annotated with controller().

    See also the bind() function.

  • assets = null

    A tuple [filesystem folder, context root] used to serve static assets. See the serve() function.

  • modulesPath = null

    A context root used to serve modules.

  • filters = []

    Additional (chained) filters run before each request.

  • renderer = null

    A template renderer

  • transformers = []

    Transformers that can serialize to responses and deserialize from request bodies.

Attributes
addressSource Codeshared String address

The address or hostname on which the HTTP server will be bound.

portSource Codeshared Integer port

The port on which the server will listen.

Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
runSource Codeshared void run(Anything(Status) statusListener = ...)

Starts the web application.

Parameters:
  • statusListener = noop
stopSource Codeshared void stop()

Stops the web application, if started, and inhibits any further attempts to start it.

Inherited Methods
Methods inherited from: Object
equals
Nested Aliases
FilterSource Codeshared Filter=> Anything(Request, Response, Anything(Request, Response))

A filter applied to each incoming request before it is dispatched to its matching handler. Multiple filters can be chained, and returning false will stop the chain. In this case, the filter returning false should modify the Response such as it can be returned to the client.