Example usage for org.springframework.http HttpHeaders IF_MODIFIED_SINCE

List of usage examples for org.springframework.http HttpHeaders IF_MODIFIED_SINCE

Introduction

In this page you can find the example usage for org.springframework.http HttpHeaders IF_MODIFIED_SINCE.

Prototype

String IF_MODIFIED_SINCE

To view the source code for org.springframework.http HttpHeaders IF_MODIFIED_SINCE.

Click Source Link

Document

The HTTP If-Modified-Since header field name.

Usage

From source file:org.ambraproject.rhino.rest.controller.IssueCrudController.java

@Transactional(rollbackFor = { Throwable.class })
@RequestMapping(value = "/journals/{journalKey}/volumes/{volumeDoi}/issues/{issueDoi:.+}", method = RequestMethod.PATCH)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "IssueInputView", value = "example #1: {\"displayName\": \"July\"}<br>"
        + "example #2: {\"imageArticleDoi\": \"10.1371/image.pbio.v02.i07\"}<br>"
        + "example #3: {\"articleOrder\": [\"10.1371/journal.pbio.0020213\", \"10.1371/journal.pbio.0020214\", "
        + "\"10.1371/journal.pbio.0020228\"]}")
public ResponseEntity<?> update(HttpServletRequest request,
        @RequestHeader(value = HttpHeaders.IF_MODIFIED_SINCE, required = false) Date ifModifiedSince,
        @PathVariable("journalKey") String journalKey, @PathVariable("volumeDoi") String volumeDoi,
        @PathVariable("issueDoi") String issueDoi) throws IOException {
    // TODO: Validate journalKey and volumeDoiObj
    IssueIdentifier issueId = getIssueId(issueDoi);
    IssueInputView input = readJsonFromRequest(request, IssueInputView.class);
    issueCrudService.update(issueId, input);

    return issueCrudService.serveIssue(issueId).getIfModified(ifModifiedSince).asJsonResponse(entityGson);
}

From source file:org.ambraproject.rhino.rest.controller.VolumeCrudController.java

@Transactional(readOnly = true)
@RequestMapping(value = "/volumes/{volumeDoi:.+}", method = RequestMethod.GET)
public ResponseEntity<?> read(
        @RequestHeader(value = HttpHeaders.IF_MODIFIED_SINCE, required = false) Date ifModifiedSince,
        HttpServletRequest request, HttpServletResponse response, @PathVariable("volumeDoi") String volumeDoi)
        throws IOException {
    VolumeIdentifier volumeId = getVolumeId(volumeDoi);
    return volumeCrudService.serveVolume(volumeId).getIfModified(ifModifiedSince).asJsonResponse(entityGson);
}

From source file:org.ambraproject.rhino.rest.controller.VolumeCrudController.java

@Transactional(readOnly = true)
@RequestMapping(value = "/journals/{journalKey}/volumes/{volumeDoi:.+}", method = RequestMethod.GET)
public ResponseEntity<?> read(
        @RequestHeader(value = HttpHeaders.IF_MODIFIED_SINCE, required = false) Date ifModifiedSince,
        @PathVariable("journalKey") String journalKey, @PathVariable("volumeDoi") String volumeDoi)
        throws IOException {
    // TODO: Validate journalKey
    VolumeIdentifier volumeId = getVolumeId(volumeDoi);
    return volumeCrudService.serveVolume(volumeId).getIfModified(ifModifiedSince).asJsonResponse(entityGson);
}