Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-11792 Server-side HTTP caching improvements
  3. SPR-8550

Provide controller method level alternative to WebContentInterceptor

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.0.6
    • Fix Version/s: 4.2 RC1
    • Component/s: Web
    • Labels:
    • Last commented by a User:
      false

      Description

      Even though WebContentInterceptor can be used to declare when and how cache-control headers are set in a response, it isn't as straightforward or consistent with the @Controller model.

      I propose an annotation-based option for declaring when cache-control headers are added to a response. For example, a general-purpose @CachePolicy annotation might be used like this:

      @CachePolicy(maxAge=60)
      @RequestMapping(value="/headlines", method=RequestMethod.GET)
      public String showHeadlines() { ... }
      

      Also, perhaps a more specific-purpose @PreventCaching annotation might declare that a response include the headers currently added by WebContentGenerator's preventCaching() method.

      These two annotations are just suggestions--I'd be interested in any solution that allows for declarative cache policies at the request method level.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bclozel Brian Clozel
                Reporter:
                habuma Craig Walls
                Last updater:
                Rossen Stoyanchev
              • Votes:
                10 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  25 weeks, 1 day ago