@Override public StompClientConnection send(String destination, Map<String, String> headers, Buffer body, Handler<Frame> receiptHandler) { // No need for synchronization, no field access, except client (final) if (headers == null) { headers = new Headers(); } if (destination != null) { headers.put(Frame.DESTINATION, destination); } // At that point, the 'destination' header must be set. if (headers.get(Frame.DESTINATION) == null) { throw new IllegalArgumentException("The 'destination' header is mandatory : " + headers); } if (body != null && client.options().isAutoComputeContentLength() && !headers.containsKey(Frame.CONTENT_LENGTH)) { headers.put(Frame.CONTENT_LENGTH, Integer.toString(body.length())); } Frame frame = new Frame(Frame.Command.SEND, headers, body); return send(frame, receiptHandler); }
public static void toJson(StompClientOptions obj, java.util.Map<String, Object> json) { if (obj.getAcceptedVersions() != null) { JsonArray array = new JsonArray(); obj.getAcceptedVersions().forEach(item -> array.add(item)); json.put("acceptedVersions", array); } json.put("autoComputeContentLength", obj.isAutoComputeContentLength()); json.put("bypassHostHeader", obj.isBypassHostHeader()); if (obj.getHeartbeat() != null) { json.put("heartbeat", obj.getHeartbeat()); } if (obj.getHost() != null) { json.put("host", obj.getHost()); } if (obj.getLogin() != null) { json.put("login", obj.getLogin()); } if (obj.getPasscode() != null) { json.put("passcode", obj.getPasscode()); } json.put("port", obj.getPort()); json.put("trailingLine", obj.isTrailingLine()); json.put("useStompFrame", obj.isUseStompFrame()); if (obj.getVirtualHost() != null) { json.put("virtualHost", obj.getVirtualHost()); } } }