From 68b230f42f93a2e801292a2085cc3fce3a676823 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 25 Nov 2016 10:04:29 +0300 Subject: juick-api: JSONP and CORS --- .../src/main/java/com/juick/api/controllers/Messages.java | 1 + .../java/com/juick/api/controllers/util/JsonpAdvice.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 juick-api/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java (limited to 'juick-api/src/main/java/com/juick/api/controllers') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index a6bd3f6d..f4cde321 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; diff --git a/juick-api/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java b/juick-api/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java new file mode 100644 index 00000000..cc14976b --- /dev/null +++ b/juick-api/src/main/java/com/juick/api/controllers/util/JsonpAdvice.java @@ -0,0 +1,14 @@ +package com.juick.api.controllers.util; + +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice; + +/** + * Created by vitalyster on 25.11.2016. + */ +@ControllerAdvice +public class JsonpAdvice extends AbstractJsonpResponseBodyAdvice { + public JsonpAdvice() { + super("callback"); + } +} -- cgit v1.2.3