Skip to Content
RESTful Java Web Services - Third Edition
book

RESTful Java Web Services - Third Edition

by Balachandar Bogunuva Mohanram
November 2017
Intermediate to advanced
420 pages
10h 29m
English
Packt Publishing
Content preview from RESTful Java Web Services - Third Edition

@GET

A RESTful system uses the HTTP GET method type for retrieving the resources referenced in the URI path. The @javax.ws.rs.GET annotation designates the method of a resource class to respond to the HTTP GET requests.

The following code snippet illustrates the use of the @GET annotation to make a method respond to the HTTP GET request type. In this example, the REST URI for accessing the findAllDepartments() method may look like /departments. The complete URI path may take the http://host:port/<context-root>/<application-path>/departments URI pattern:

//imports removed for brevity @Path("departments") public class DepartmentService { @GET @Produces(MediaType.APPLICATION_JSON) public List<Department> findAllDepartments() { //Find all departments ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

RESTful Java Web Services, Second Edition

RESTful Java Web Services, Second Edition

Jobinesh Purushothaman
Java Web Services

Java Web Services

David A Chappell, Tyler Jewell

Publisher Resources

ISBN: 9781788294041Supplemental Content