{"id":25719995,"url":"https://github.com/gregwhitaker/ratpack-defaultcachecontrol-example","last_synced_at":"2025-11-18T21:02:10.365Z","repository":{"id":82732599,"uuid":"157583072","full_name":"gregwhitaker/ratpack-defaultcachecontrol-example","owner":"gregwhitaker","description":"Example of setting a default cache-control header in Ratpack","archived":false,"fork":false,"pushed_at":"2018-11-15T01:21:23.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T17:41:25.100Z","etag":null,"topics":["cache-control","ratpack","ratpack-api","ratpackweb"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregwhitaker.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-14T17:06:16.000Z","updated_at":"2019-02-28T22:33:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"6bd8608c-4bdc-4921-bb92-36a6b06dce46","html_url":"https://github.com/gregwhitaker/ratpack-defaultcachecontrol-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregwhitaker/ratpack-defaultcachecontrol-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-defaultcachecontrol-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-defaultcachecontrol-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-defaultcachecontrol-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-defaultcachecontrol-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/ratpack-defaultcachecontrol-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-defaultcachecontrol-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285138471,"owners_count":27121052,"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","status":"online","status_checked_at":"2025-11-18T02:00:05.759Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cache-control","ratpack","ratpack-api","ratpackweb"],"created_at":"2025-02-25T17:36:16.548Z","updated_at":"2025-11-18T21:02:10.360Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","readme":"# ratpack-defaultcachecontrol-example\n[![Build Status](https://travis-ci.org/gregwhitaker/ratpack-defaultcachecontrol-example.svg?branch=master)](https://travis-ci.org/gregwhitaker/ratpack-defaultcachecontrol-example)\n\nAn example of setting a default cache-control header in a [Ratpack](https://ratpack.io) application.\n\n## Running the Example\n1. Run the following command to start the application:\n\n        ./gradlew run\n        \n2. Run the following command to call the `/api/v1/get` endpoint with its own cache-control header set:\n\n        curl -v http://localhost:5050/api/v1/get\n        \n    Notice that the `Cache-Control` header is set to a value of `3600` seconds, which is the value that was explicitly set in the handler.\n\n        *   Trying ::1...\n        * TCP_NODELAY set\n        * Connected to localhost (::1) port 5050 (#0)\n        \u003e GET /api/v1/get HTTP/1.1\n        \u003e Host: localhost:5050\n        \u003e User-Agent: curl/7.54.0\n        \u003e Accept: */*\n        \u003e\n        \u003c HTTP/1.1 200 OK\n        \u003c Cache-Control: max-age=3600\n        \u003c content-type: text/plain;charset=UTF-8\n        \u003c content-length: 35\n        \u003c\n        * Connection #0 to host localhost left intact\n        \n3. Next, run the following command to call the `api/v1/getwithoutcache` endpoint:\n\n        curl -v http://localhost:5050/api/v1/getwithoutcache\n        \n    Notice that the `Cache-Control` header is set to a value of `1` second, which is the default value set by the filter.\n\n        *   Trying ::1...\n        * TCP_NODELAY set\n        * Connected to localhost (::1) port 5050 (#0)\n        \u003e GET /api/v1/getwithoutcache HTTP/1.1\n        \u003e Host: localhost:5050\n        \u003e User-Agent: curl/7.54.0\n        \u003e Accept: */*\n        \u003e\n        \u003c HTTP/1.1 200 OK\n        \u003c content-type: text/plain;charset=UTF-8\n        \u003c content-length: 61\n        \u003c Cache-Control: max-age=1\n        \u003c\n        * Connection #0 to host localhost left intact\n\n## Bugs and Feedback\nFor bugs, questions, and discussions please use the [Github Issues](https://github.com/gregwhitaker/ratpack-defaultcachecontrol-example/issues).\n\n## License\nMIT License\n\nCopyright (c) 2018 Greg Whitaker\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fratpack-defaultcachecontrol-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Fratpack-defaultcachecontrol-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fratpack-defaultcachecontrol-example/lists"}