{"id":19433416,"url":"https://github.com/foo4u/spring-mvc-cache-control","last_synced_at":"2025-04-24T20:31:37.950Z","repository":{"id":3105727,"uuid":"4131741","full_name":"foo4u/spring-mvc-cache-control","owner":"foo4u","description":"Spring MVC Cache Control is an extension to Spring MVC that aims to simplify implementing HTTP/1.1 Cache-Control headers for annotated MVC controllers.","archived":false,"fork":false,"pushed_at":"2018-12-19T20:56:16.000Z","size":208,"stargazers_count":77,"open_issues_count":4,"forks_count":27,"subscribers_count":11,"default_branch":"master","last_synced_at":"2023-10-31T20:08:22.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foo4u.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-25T01:40:48.000Z","updated_at":"2023-06-26T09:42:33.000Z","dependencies_parsed_at":"2022-08-24T10:52:11.185Z","dependency_job_id":null,"html_url":"https://github.com/foo4u/spring-mvc-cache-control","commit_stats":null,"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fspring-mvc-cache-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fspring-mvc-cache-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fspring-mvc-cache-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fspring-mvc-cache-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo4u","download_url":"https://codeload.github.com/foo4u/spring-mvc-cache-control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223967577,"owners_count":17233407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T14:39:45.505Z","updated_at":"2024-11-10T14:39:46.121Z","avatar_url":"https://github.com/foo4u.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring MVC Cache Control\n\n[![Maven Central][central-badge]][central] ![Build Status][status]\n\nSpring MVC Cache Control is an extension to [Spring MVC][spring_mvc] that aims to simplify implementing HTTP/1.1 Cache-Control headers for annotated MVC controllers.\n\n## Usage\n\n### Add Spring MVC Cache Control to Your Project.\n\n#### Maven Projects\n\n``` \n\u003cdependency\u003e\n    \u003cgroupId\u003enet.rossillo.mvc.cache\u003c/groupId\u003e\n    \u003cartifactId\u003espring-mvc-cache-control\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.1-RELEASE\u003c/version\u003e\n    \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle Projects\n\n```\ncompile 'net.rossillo.mvc.cache:spring-mvc-cache-control:1.1.1-RELEASE'\n```\n\n### Configuration\n\nSimply include `net.rossillo.spring.web.mvc.CacheControlHandlerInterceptor` in your Spring MVC configuration.\n\n#### XML Web Application Context\n\n```\n\u003cmvc:interceptors\u003e\n    \u003cbean class=\"net.rossillo.spring.web.mvc.CacheControlHandlerInterceptor\" /\u003e\n\u003c/mvc:interceptors\u003e\n```\n\n_For XML contexts, this usually defaults to `${appName}-servlet.xml`_\n\n#### Java Web Application Context\n\n```\n@Configuration\npublic class WebMvcConfig extends WebMvcConfigurerAdapter implements WebMvcConfigurer\n{\n    @Override\n    public void addInterceptors(InterceptorRegistry registry)\n    {\n        registry.addInterceptor(new CacheControlHandlerInterceptor());\n    }\n}\n```\n\n### Annotate Your Controllers\n\nUse the `@CacheControl` annotation on either (or both) type level `@Controller`s or method level `@RequestMapping`s. The handler interceptor will read the annotations and generate HTTP/1.1 compliant cache-control headers. For example:\n\n```\n@Controller\npublic final class DemoController {\n\n\t/**\n\t * Public home page, cacheable for 5 minutes.\n\t */\n\t@CacheControl(maxAge = 300)\n\t@RequestMapping({\"/\", \"/home.do\"})\n\tpublic String handleHomePageRequest(Model model) {\n\t\t...\n\t}\n}\n```\n\nSee our [spring-mvc-cache-control-demo][demo] project for full details.\n\n\n## Building from Source\n\n1. Clone the repository from GitHub:\n\n\t\t$ git clone git://github.com/foo4u/spring-mvc-cache-control\n\n2. Navigate into the cloned repository directory:\n\n\t\t$ cd spring-mvc-cache-control\n\n3. The project uses [Gradle][gradle] to build:\n\n\t\t$ ./gradlew build\n\n## IDE Integration\n\n### IntelliJ IDEA\n\nIDEA 13+ natively support Gralde projects. Simply choose to import an existing project and select\nthe build.gradle file. Tick the checkbox to use the Gradle wrapper.\n\n### Eclipse\n\nTo generate Eclipse metadata (.classpath and .project files), use the following Gradle task:\n\n\t$ ./gradlew eclipse\n\nOnce complete, you may then import the projects into Eclipse as usual:\n\n\tFile -\u003e Import -\u003e Existing projects into workspace\n\n## JavaDoc\n\nUse the following Gradle task to build the JavaDoc\n\n\t$ ./gradlew javadoc\n\t\n_Note: The result will be available in 'spring-mvc-cache-control/build/docs/javadoc'._\n\t\n## Contributing\n\nContributions are always welcome. Fork the repository, create a topic branch and send a pull request.\n\n\n[spring_mvc]: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html\n[gradle]: http://gradle.org/\n[demo]: https://github.com/foo4u/spring-mvc-cache-control/blob/master/spring-mvc-cache-control-demo/src/main/java/net/rossillo/spring/web/mvc/demo/DemoController.java\n[status]: https://circleci.com/gh/foo4u/spring-mvc-cache-control.png?circle-token=2671c269c8ab085fb58617d58167ffe45bc70aac\n[central]: https://maven-badges.herokuapp.com/maven-central/net.rossillo.mvc.cache/spring-mvc-cache-control\n[central-badge]: https://maven-badges.herokuapp.com/maven-central/net.rossillo.mvc.cache/spring-mvc-cache-control/badge.svg\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo4u%2Fspring-mvc-cache-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo4u%2Fspring-mvc-cache-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo4u%2Fspring-mvc-cache-control/lists"}