December 2017
Intermediate to advanced
372 pages
8h 46m
English
We can add parameters to methods that will handle HTTP requests in our web service. Parameters decorated with the @QueryParam annotation will be retrieved from the request URL.
The following example illustrates how to use query parameters in our JAX-RS RESTful web services:
package com.ensode.javaee8book.queryparams.service; import com.ensode.queryparams.entity.Customer; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; @Path("customer") public class CustomerResource { private Customer customer; public CustomerResource() { customer = new Customer(1L, "Samuel", ...