-
Notifications
You must be signed in to change notification settings - Fork 2
Jersey
The flatpack-jersey Maven artifact provides glue code in FlatPackProvider to attach the FlatPack serialization stack to Jersey`s request dispatch framework. Developers can write REST endpoints in terms of full domain entities, rather than simple DTO types.
There are many servlet and jax-rs containers available to developers, and the choice of Jersey and Jetty should in no way imply that the use of FlatPack is specific to those two implementations.
A basic server project is located in [demo-server'][demo-server]. Most of the classes there are implementations of types described in the [[core api|Core]], so this document will just concentrate on DemoServerandDemoApplication`.
The server bootstrap is located in DemoSever and is fairly straightforward. Jersey is installed as a servlet into a Jersey instance. FlatPackProvider is installed as a Jersey-specific ContainerRequest filter. The ConstraintSecurityHandler is a Jetty API, and DemoAuthenticator provides simple Principal objects to demonstrate role-based property access.
The DemoApplication class configures the FlatPack stack and attaches a DemoResource. Note particularly the describeGet() method, which produces an ApiDescription which can be used by FastTool to generate client libraries.