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

Using the Expires header to control the validity of the HTTP cache

You can use the Expires HTTP header field to let all entities involved in the request-response chain know when a resource has expired. The Expires HTTP header was defined as part of the HTTP/1.0 specification. You can specify the date and time in the Expires header, after which the resource fetched from the server is considered stale.

The following code snippet shows how you can add the Expires HTTP header to the resource returned by the method:

@GET 
@Path("departments/{id}/holidays") 
@Produces(MediaType.APPLICATION_JSON) 
public Response getHolidayListForCurrentYear(@PathParam("id")  Short deptId) { //Reads the list of holidays List<Date> holidayList = getHolidayListForDepartment(deptId); ...
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