HttpApp

io.eezo.http.HttpApp
trait HttpApp extends Dispatch

The http layer's entry trait: the one an application on eezo-http alone extends.

object Main extends HttpApp {
 override def routes: RouteTable = Routes.table()
}

The layer is declarative. The application names its routes, and every knob of the server is an override beside port; nothing in user code calls HttpServer.run. main is inherited from Dispatch: sbt run boots, eezo dev (the plugin's eezoDev, or sbt "run dev" without the restart on save) serves with the listing and the reload client on, eezo routes prints the table, and any other first argument is unknown. The database layer's commands do not exist here: an application that needs them depends on eezo and extends EezoApp, which stacks both layers.

serve is the only call site of HttpServer.run in the entry traits, so boot and dev see the same overrides. Both are virtual hooks the umbrella overrides: program to run boot under the database, devServer to run the drift check first.

Attributes

Source
HttpApp.scala
Graph
Supertypes
trait Dispatch
class Object
trait Matchable
class Any
Known subtypes
trait LiveApp
trait EezoApp

Members list

Value members

Abstract methods

The route table, usually Routes.table() from the sbt plugin's generated object. Abstract: an http layer is its routes, and an application without any is a mistake.

The route table, usually Routes.table() from the sbt plugin's generated object. Abstract: an http layer is its routes, and an application without any is a mistake.

Attributes

Source
HttpApp.scala

Concrete methods

def boot(): Unit

The application. The default serves routes on port, which is what makes the minimal application one override and nothing else. Override it for anything more: background work, another setup, no server at all.

The application. The default serves routes on port, which is what makes the minimal application one override and nothing else. Override it for anything more: background work, another setup, no server at all.

Attributes

Source
HttpApp.scala
override protected def commands: PartialFunction[List[String], Int]

The commands this application answers, as first argument :: rest. Nil is program and is answered here, once, so no layer owns it. Each layer writes own orElse super.commands for its own commands, so the later mixin's arms are consulted first.

The commands this application answers, as first argument :: rest. Nil is program and is answered here, once, so no layer owns it. Each layer writes own orElse super.commands for its own commands, so the later mixin's arms are consulted first.

Attributes

Definition Classes
Source
HttpApp.scala
protected def devServer(): Unit

What dev serves. The umbrella overrides it to run the drift check first and serve the drift page when the check blocks.

What dev serves. The umbrella overrides it to run the drift check first and serve the drift page when the check blocks.

Attributes

Source
HttpApp.scala
protected def frameworkRoutes: Seq[Route]

Routes the framework itself contributes, appended to whatever table serve is given so that every caller — boot's default, a user's own serve in an overridden boot, dev — serves them without knowing they exist. Empty here: eezo-live's LiveApp overrides it with the live socket and its client script, and EezoApp mixes that in. Appended, so the user's table keeps winning any path both name; they show in the boot listing (they are served, and the listing does not lie) but not in eezo routes, which is the user's table.

Routes the framework itself contributes, appended to whatever table serve is given so that every caller — boot's default, a user's own serve in an overridden boot, dev — serves them without knowing they exist. Empty here: eezo-live's LiveApp overrides it with the live socket and its client script, and EezoApp mixes that in. Appended, so the user's table keeps winning any path both name; they show in the boot listing (they are served, and the listing does not lie) but not in eezo routes, which is the user's table.

Attributes

Source
HttpApp.scala
def layout: Layout

The frame every HTML reply comes back in, the derived pages, the login page and the error page included. eezo's plain one unless the application names its own here, which is the one place a frame can be chosen, so that no route has to remember to ask for it.

The frame every HTML reply comes back in, the derived pages, the login page and the error page included. eezo's plain one unless the application names its own here, which is the one place a frame can be chosen, so that no route has to remember to ask for it.

Attributes

Source
HttpApp.scala
def maxBodySize: Long

The request body cap, and the WebSocket text message cap with it.

The request body cap, and the WebSocket text message cap with it.

Attributes

Source
HttpApp.scala
def port: Int

Where boot's default and the dev command serve.

Where boot's default and the dev command serve.

Attributes

Source
HttpApp.scala
def problems: PartialFunction[Throwable, Problem]

How the application's own failures are answered: a partial function from what a handler threw to the problem the client sees. What it does not cover, the boundary answers as 500.

How the application's own failures are answered: a partial function from what a handler threw to the problem the client sees. What it does not cover, the boundary answers as 500.

Attributes

Source
HttpApp.scala
protected def program(): Unit

What sbt run does on this layer alone: boot, under nothing. The umbrella overrides it to run the same boot under the database layer's lifecycle, the way it overrides devServer. No override here, deliberately: see Dispatch.program.

What sbt run does on this layer alone: boot, under nothing. The umbrella overrides it to run the same boot under the database layer's lifecycle, the way it overrides devServer. No override here, deliberately: see Dispatch.program.

Attributes

Source
HttpApp.scala
def secret: Secret

The key the session cookie is signed with. EEZO_SECRET by default. The sbt plugin's dev loop sets it to one secret per sbt session, so a restart on edit keeps the developer signed in. A run outside that loop with nothing set gets a throwaway announced at WARNING, so that hello runs with no configuration and a deployment that forgot is told. Read once, when serve boots.

The key the session cookie is signed with. EEZO_SECRET by default. The sbt plugin's dev loop sets it to one secret per sbt session, so a restart on edit keeps the developer signed in. A run outside that loop with nothing set gets a throwaway announced at WARNING, so that hello runs with no configuration and a deployment that forgot is told. Read once, when serve boots.

Attributes

Source
HttpApp.scala
final protected def serve(table: RouteTable, dev: Boolean = ...): Unit

The only caller of HttpServer.run: boots the server on this trait's overrides and blocks until it stops. dev turns the listing and the reload client on.

The only caller of HttpServer.run: boots the server on this trait's overrides and blocks until it stops. dev turns the listing and the reload client on.

Attributes

Source
HttpApp.scala
override protected def usage: List[Usage]

One row per command, for help. Each layer writes own ++ super.usage, and names only the spelling and the description: the columns are help's to lay out, once, over every layer's rows together, so no layer has to guess how wide the others' spellings are.

One row per command, for help. Each layer writes own ++ super.usage, and names only the spelling and the description: the columns are help's to lay out, once, over every layer's rows together, so no layer has to guess how wide the others' spellings are.

Attributes

Definition Classes
Source
HttpApp.scala

Inherited methods

final def main(args: Array[String]): Unit

Attributes

Inherited from:
Dispatch
Source
Dispatch.scala