-
Notifications
You must be signed in to change notification settings - Fork 0
autre sol
Kais NAFFOUTI edited this page Apr 16, 2018
·
1 revision
@Controller @RequestMapping("/") public class ApplicationController {
@CrossOrigin
@RequestMapping(value="/Changes", method = RequestMethod.GET)
public String inspect(ModelMap model) {
model.addAttribute("msg", "example");
return "index";
}
}
@OPTIONS @Path("/getsample") public Response getOptions() { return Response.ok() .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build(); }
dans le web services
If non of this work, try to exchange the "" provided for "Access-Control-Allow-Origin" header with your custom domain where you access this resource. I.g. If you call this from http://localhost::8080 use something like this ("Access-Control-Allow-Origin", "http://localhost:8080") instead of asterisk ""