diff options
author | Vitaly Takmazov | 2016-11-25 10:04:29 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-25 10:04:29 +0300 |
commit | 68b230f42f93a2e801292a2085cc3fce3a676823 (patch) | |
tree | d2da2ed337641689829c1e483305046de01080b3 /juick-api/src/main/java/com/juick/api/ApiServer.java | |
parent | 6b018f65a4f0391bb7f8e2a06616b8541d0a452e (diff) |
juick-api: JSONP and CORS
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/ApiServer.java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/ApiServer.java | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java index c76c165a..80b2b31b 100644 --- a/juick-api/src/main/java/com/juick/api/ApiServer.java +++ b/juick-api/src/main/java/com/juick/api/ApiServer.java @@ -28,10 +28,6 @@ import rocks.xmpp.core.session.XmppSessionConfiguration; import rocks.xmpp.extensions.component.accept.ExternalComponent; import javax.annotation.PostConstruct; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; /** * @author Ugnich Anton @@ -91,26 +87,6 @@ public class ApiServer implements AutoCloseable { } } - public static void replyJSON(HttpServletRequest request, HttpServletResponse response, String json) throws IOException { - response.setContentType("application/json; charset=UTF-8"); - response.setHeader("Access-Control-Allow-Origin", "*"); - - String callback = request.getParameter("callback"); - if (callback != null && (callback.length() > 64 || !callback.matches("[a-zA-Z0-9\\-\\_]+"))) { - callback = null; - } - - try (PrintWriter out = response.getWriter()) { - if (callback != null) { - out.print(callback + "("); - out.print(json); - out.print(")"); - } else { - out.print(json); - } - } - } - public ExternalComponent getXmpp() { return xmpp; } |