API Summary
What App provides
-
Routes:
get,post,put,patch,delete,head,options, andpath(prefix, group → …)— patterns and matching order in Routing -
Introspection:
routes()reports every registered route asRoute(method, path), in registration order -
Filters:
before(filter)/before(path, filter), same forafter -
Errors:
exception(Type, handler),error(HttpStatus, handler),notFound(handler) -
Rendering and assets:
templates(renderer),staticFiles(classpathRoot),staticFiles(StaticFiles)— jte overclasspath:/jteandclasspath:/publicat the root are the defaults, so neither has to be called;FreeMarkerTemplates,HandlebarsTemplates, andThymeleafTemplatesareTemplateRendererimplementations in modules of their own -
Server:
start()/start(port),stop(),join(),port(),server(factory)
What WebRequest provides
-
Request info:
method(),path(),header(name),raw()for the servlet request itself -
Path variables:
pathParam,pathParamLong,pathParamEnum -
Parameters:
param(400 when missing),paramLong,paramEnum, each with a(…, default)form for optional parameters;paramBoolean(name, default);params(name)for repeated values -
Query vs. form:
queryParam,queryParams,formParam,formParams -
Cookies the client sent:
cookie(name),cookies() -
Body:
body(),bodyJson(),bodyJson(reader)(400 on a body the reader rejects), multipart upload viafile(name) -
Session:
sessionAttr(key)/sessionAttr(key, value)/removeSessionAttr -
Flash:
flash(key, value), read exactly once withflashed(key)on the request after a redirect -
Errors:
errorMessage()inside anerror(status, handler)handler
What WebResponse provides
-
Bodies:
html,text,json(raw),json(JsonValue),json(value, writer),bytes,template(name),template(name, model),stream(contentType, out → …),sse(stream → …),raw((req, res) → …) -
Statuses:
empty(),empty(HttpStatus),noContent(),redirect(location),redirect(location, HttpStatus) -
Building on:
status,header,contentType,attachment,body,cookie(name, value),cookie(name, value, maxAge),cookie(Cookie),removeCookie -
Reading back:
status(),header(name),headers(),cookies(),body()
See The Response for the shape of body() and the lambda families.