synchronized boolean handleMessages(String messages) { String[] msgArr = parseMessageString(messages); if (msgArr == null) { return false; } handleMessages(msgArr); return true; }
private void handleMessages(String msgs) { if (!session.isClosed()) { if (msgs.equals("") || msgs.equals("[]")) { //Ignore empty frames } else if ((msgs.startsWith("[\"") && msgs.endsWith("\"]")) || (msgs.startsWith("\"") && msgs.endsWith("\""))) { session.handleMessages(msgs); } else { //Invalid JSON - we close the connection close(); } } }
private synchronized void handleMessages(String[] messages) { if (context == Vertx.currentContext()) { for (String msg : messages) { pendingReads.write(buffer(msg)); } } else { context.runOnContext(v -> { handleMessages(messages); }); } }
if (!session.handleMessages(body)) { sendInvalidJSON(rc.response()); } else {
private void handleSendMessage(RoutingContext rc, SockJSSession session, Buffer body) { String msgs = body.toString(); if (msgs.equals("")) { rc.response().setStatusCode(500); rc.response().end("Payload expected."); return; } if (!session.handleMessages(msgs)) { sendInvalidJSON(rc.response()); } else { rc.response().putHeader("Content-Type", "text/plain; charset=UTF-8"); setNoCacheHeaders(rc); setJSESSIONID(options, rc); setCORS(rc); rc.response().setStatusCode(204); rc.response().end(); } if (log.isTraceEnabled()) log.trace("XHR send processed ok"); }
synchronized boolean handleMessages(String messages) { String[] msgArr = parseMessageString(messages); if (msgArr == null) { return false; } handleMessages(msgArr); return true; }
private void handleMessages(String msgs) { if (!session.isClosed()) { if (msgs.equals("") || msgs.equals("[]")) { //Ignore empty frames } else if ((msgs.startsWith("[\"") && msgs.endsWith("\"]")) || (msgs.startsWith("\"") && msgs.endsWith("\""))) { session.handleMessages(msgs); } else { //Invalid JSON - we close the connection close(); } } }
private synchronized void handleMessages(String[] messages) { if (context == Vertx.currentContext()) { for (String msg : messages) { pendingReads.write(buffer(msg)); } } else { context.runOnContext(v -> { handleMessages(messages); }); } }
if (!session.handleMessages(body)) { sendInvalidJSON(rc.response()); } else {
private void handleSendMessage(RoutingContext rc, SockJSSession session, Buffer body) { String msgs = body.toString(); if (msgs.equals("")) { rc.response().setStatusCode(500); rc.response().end("Payload expected."); return; } if (!session.handleMessages(msgs)) { sendInvalidJSON(rc.response()); } else { rc.response().putHeader("Content-Type", "text/plain; charset=UTF-8"); setNoCacheHeaders(rc); setJSESSIONID(options, rc); setCORS(rc); rc.response().setStatusCode(204); rc.response().end(); } if (log.isTraceEnabled()) log.trace("XHR send processed ok"); }