Results 1 to 2 of 2

Thread: Last-Modified header with @Controller annotation

Hybrid View

  1. #1

    Default Last-Modified header with @Controller annotation

    Hi,

    I'm implementting a REST web service based on a MVC @Controller annotated class. I've implemented the Etag functionality with the provided Filter and I'd like to include the Last-Modified header when returning the resource representations too. I've seen that there is a LastModified interface which should be implemented by the controller, but my problem is that I want to include the mentioned header for some of the methods implementing the REST API, and I don't know how to accomplish it.

    By the way, I'm using Spring 3.0.5

    Please, could anybody provide some hint?

    Best regards,
    Juan Carlos

  2. #2

    Default

    Perhaps there is a better way, but you can just do it manually:

    Code:
    @RequestMapping("getDigitizingContent/{panelName}/{versionNumber}")    public String getDigitizingContentByPanelNameWithVersionHandler(@PathVariable String panelName, Model model, HttpServletResponse response) {
        
            response.setHeader("Cache-Control", "public, max-age=31556926"); 
            response.setDateHeader("Last-Modified", lastModifiedDate);
    return model; //etc
        }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •