Resource Model
1. Envelop
Envelop word refer from SOAP web service, and it contains following field:
- status:
io.horizon.eon.em.web.HttpStatusCode
- Http Status Enum data. - headers:
io.vertx.core.MultiMap
- Http Headers ( Direct from Vert.x ) - error:
io.horizon.exception.WebException
- Abstract Web Error defined by Zero - data:
io.vertx.core.json.JsonObject
- Data Part in current Envelop - user:
io.vertx.ext.auth.User
- User Info ( Direct from Vert.x )
2. Common Api
// Extract data from Envelop
final JsonObject data = message.data();
// Extract T from Envelop
final Demo user = message.data(Demo.class);
// Extract data from Message<Envelop>, static ( Be careful )
final Demo user = Envelop.data(message, Demo.class);
// Build Successful Envelop
final Envelop envelop = Envelop.ok();
// Build Successful Envelop with data
Demo user = ...
final Envelop envelop = Envelop.success( user );
// Build Error Envelop with WebException
WebException exception = ...
final Envelop error = Envelop.failure(exception);
4. Data Format
Success:
Failure
- brief: Http Status
- status: Http Status Code
- data: Data part ( Successful only )
- code: Zero Error Code ( Negative number )
- message: Zero Message ( Describe the number meaning )