November 2017
Intermediate to advanced
420 pages
10h 29m
English
With a lot of mobile applications being used in the market, it becomes essential to enable faster transmission of large chunks of data over a network. RESTEasy provides the GZIP compression/decompression feature. When the response body is plain text, it can be easily compressed on the server side and then decompressed on the client side. RESTEasy accomplishes this with the @GZIP annotation applied at the method level, as shown ahead:
/** * Returns list of departments * */ @GET @Produces(MediaType.APPLICATION_JSON) @GZIP public List<Departments> findAllDepartments() { //Find all departments from the data store and return compressed response javax.persistence.criteria.CriteriaQuery cq = entityManager.getCriteriaBuilder().createQuery(); ...