Day 04 — JSON-B / JSON-P Processing & Unified Exception Handling¶
Daily Time Investment: 2.5 hours | Week: 1 | Phase: 3
Daily Schedule¶
| Segment | Duration | Activity |
|---|---|---|
| Core Theory | 45 min | JSON-B 3.0 annotations, JSON-P DOM/Streaming API, ExceptionMapper<T>, RFC-7807 |
| Book Reading | 30 min | EE8 AppDev Ch6 (JSON-P + JSON-B) + EE8 AppDev Ch10 (ExceptionMapper) |
| Hands-On Lab | 75 min | RFC-7807 ExceptionMapper pipeline + JSON-P AST endpoint |
Files in This Day¶
-
EE8 AppDev Ch6 — JSON-P & JSON-B
JSON-P Model API, Streaming API, JSON Pointer, JSON Patch. JSON-B
toJson()/fromJson()basics. -
EE8 AppDev Ch10 — ExceptionMapper (cross-ref)
JAX-RS
ExceptionMapper<T>,@Provider, RFC-7807 problem details.Ch10 full content is in Day 03. This page covers the ExceptionMapper section specifically.
-
Lab Guide — JSON Processing & Exception Architecture
@JsonbProperty,@JsonbTransient,JsonbAdapter, dynamic JSON-P DOM, RFC-7807 ExceptionMapper chain.
Prerequisites to Continue¶
New concepts in Phase 3 not seen in Phase 1 or Phase 2
- RFC-7807 — "Problem Details for HTTP APIs" IETF standard; defines
application/problem+jsonmedia type for standardized error responses JsonbAdapter<OriginalType, AdaptedType>— two-method interface:adaptToJson(O)converts to wire type;adaptFromJson(A)converts back- JSON-P vs JSON-B — JSON-P is the low-level DOM/streaming API; JSON-B builds on top for transparent POJO mapping
@Providerregistration — in embedded Jersey useResourceConfig.register(MyMapper.class); on a real app server it's auto-discovered via classpath scanningContent-Type: application/problem+json— a distinct MIME type fromapplication/json; clients switch error handling behavior on it