Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

CDI Extensions Web Fragments Bean Validation 2.0 CDI 2.0 Managed Beans 1.0 JCA 1.7 JPA 2.2 JMS 2.0 JSP 2.3 EL 3.0 EJB 3.2 Batch 1.0 JSF 2.3 Interceptors 1.2 Mail 1.6 Common Annotations 1.3 JTA 1.2 JAX-WS 1.4 JAX-RS 2.1 Concurrency 1.0 JSON-P 1.1 JSON-B 1.0 WebSocket 1.1 JAPSIC 1.1 JACC 1.5 Security 1.0 Servlet 4.0 JCache 1.0

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

@ApplicationPath("api") public class JAXRSConfiguration extends Application { } @Path("hello") public class HelloWorldResource { @GET @Produces(MediaType.APPLICATION_JSON) public JsonObject helloWorld() { String hostname = ofNullable(getenv("HOSTNAME")).orElse("localhost"); return Json.createObjectBuilder() .add("message", "Cloud Native Application Development with Java EE.") .add("hostname", hostname) .build(); } }

Slide 12

Slide 12 text

// JSON Patch is a web standard format for describing changes in a JSON document. // The JSON Patch media type is application/json-patch+json. [ { "op": "replace", "path": "/0/aString", "value": "Patched JSON-P." } ] JsonArray jsonArray = Json.createArrayBuilder() .add(Json.createObjectBuilder() .add("aString", "Hello Json-P.") .add("aInteger", 42) .add("aBoolean", false) .add("aNullValue", JsonValue.NULL)) .build(); JsonPatch jsonPatch = Json.createPatchBuilder(jsonPatchArray).build(); jsonPatch.apply(jsonArray) Add: add a value into an object or array. Remove: remove a value from an object or array. Replace: replaces a value. Logically identical to using remove and then add. Copy: copy a value from one path to another by adding the value at a specified to another location. Move: moves a value from one place to another by removing from one location and adding to another. Test: tests for equality at a certain path for a certain value.

Slide 13

Slide 13 text

JsonbConfig jsonbConfig = new JsonbConfig() .withDateFormat("dd.MM.yyyy", Locale.GERMANY) .withFormatting(true) .withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_DASHES) .withNullValues(true) .withPropertyOrderStrategy(PropertyOrderStrategy.REVERSE); Jsonb jsonb = JsonbBuilder.newBuilder().withConfig(jsonbConfig).build(); String jsonBody = jsonb.toJson(jsonPojo); JsonbPojo jsonbPojo = jsonb.fromJson(jsonBody, JsonbPojo.class); @JsonbNillable public class JsonbPojo { @JsonbProperty(value = "greeting", nillable = true) private String message; @JsonbNumberFormat("#,##0.00") private Integer answerToEverything; @JsonbTransient private Object ignored; }

Slide 14

Slide 14 text

eBook or Video Discount Code: BRWSWJ50 Print Discount Code: BRWSWJ15

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content