{"push_id":619722726,"size":1,"distinct_size":1,"ref":"refs/heads/cors","head":"17f8c4b1fb1e26b00c01a60273fa891f4af31c8e","before":"fdd0df0274380851c12a57cfd261f900d32b31bf","commits":[{"sha":"17f8c4b1fb1e26b00c01a60273fa891f4af31c8e","author":{"email":"e8b5bee66e35c0361db72ae98d0619cd426c2dbe@pivotal.io","name":"Sebastien Deleuze"},"message":"Add CORS support\n\nThis commit introduces support for CORS in Spring Framework.\n\nCross-origin resource sharing (CORS) is a mechanism that allows\nmany resources (e.g. fonts, JavaScript, etc.) on a web page to\nbe requested from another domain outside the domain from which\nthe resource originated. It is defined by the CORS W3C\nrecommandation (http://www.w3.org/TR/cors/).\n\nA new annotation @CrossOrigin allows to enable CORS support\non Controller type or method level.  By default all origins\n(\"*\") are allowed.\n\n@RestController\npublic class SampleController {\n\n\t@CrossOrigin\n\t@RequestMapping(value = \"/foo\", method = RequestMethod.GET)\n\tpublic String foo() {\n\t\t// ...\n\t}\n}\n\nVarious @CrossOrigin attributes allow to customize the CORS configuration.\n\n@RestController\npublic class SampleController {\n\n\t@CrossOrigin(origin = { \"http://site1.com\", \"http://site2.com\" },\n\t\t\t\t header = { \"header1\", \"header2\" },\n\t\t\t\t method = RequestMethod.DELETE,\n\t\t\t\t maxAge = 123, allowCredentials = \"true\")\n\t@RequestMapping(value = \"/foo\", method = { RequestMethod.GET, RequestMethod.POST} )\n\tpublic String foo() {\n\t\t// ...\n\t}\n}\n\nA CorsConfigurationSource interface can be implemented by HTTP request\nhandlers that want to support CORS by providing a CorsConfiguration\nthat will be detected at AbstractHandlerMapping level. See for\nexample ResourceHttpRequestHandler that implements this interface.\n\nGlobal CORS configuration should be supported through ControllerAdvice\n(with type level @CrossOrigin annotated class or class implementing\nCorsConfiguragtionSource), or with XML namespace and JavaConfig\nconfiguration, but this is not implemented yet.\n\nIssue: SPR-9278","distinct":true,"url":"https://api.github.com/repos/sdeleuze/spring-framework/commits/17f8c4b1fb1e26b00c01a60273fa891f4af31c8e"}]}