Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Adding JsrJsonpProvider provider alone (or in a combination with other providers) allows JAX-RS resources to natively use JsonStructure, JsonArray, JsonObject as input parameters or return resultsvalues. For example:

Code Block
java
java
@GET
@Path("/books")
@Produces(MediaType.APPLICATION_JSON)
public JsonArray getBooks() {
    // Implementation here
}

@GET
@Path("/books/{bookId}")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject getBook(@PathParam("bookId") Long id) {
    // Implementation here
}

@POST
@Path("/books")
@Consumes(MediaType.APPLICATION_JSON)
public Response addBook(@Context final UriInfo uriInfo, JsonObject obj) {
    // Implementation here
}

...