本文整理了Java中org.vertx.java.core.json.JsonArray.<init>()
方法的一些代码示例,展示了JsonArray.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonArray.<init>()
方法的具体详情如下:
包路径:org.vertx.java.core.json.JsonArray
类名称:JsonArray
方法名:<init>
暂无
代码示例来源:origin: org.vert-x/vertx-core
@SuppressWarnings("unchecked")
public JsonArray getArray(String fieldName) {
List<Object> l = (List<Object>) map.get(fieldName);
return l == null ? null : new JsonArray(l);
}
代码示例来源:origin: org.vert-x/vertx-core
private static Object convertObject(final Object obj) {
Object retVal = obj;
if (obj != null) {
if (obj instanceof List) {
retVal = new JsonArray((List<Object>) obj);
} else if (obj instanceof Map) {
retVal = new JsonObject((Map<String, Object>) obj);
}
}
return retVal;
}
}
代码示例来源:origin: org.vert-x/vertx-core
@SuppressWarnings("unchecked")
public Object getField(String fieldName) {
Object obj = map.get(fieldName);
if (obj instanceof Map) {
return new JsonObject((Map<String, Object>) obj);
} else if (obj instanceof List) {
return new JsonArray((List<Object>) obj);
} else {
return obj;
}
}
代码示例来源:origin: org.vert-x/vertx-core
public JsonArray copy() {
return new JsonArray(encode());
}
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int strLength = readBuff.getInt(pos);
pos += 4;
byte[] bytes = readBuff.getBytes(pos, pos + strLength);
String str = new String(bytes, CharsetUtil.UTF_8);
body = new JsonArray(str);
}
}
代码示例来源:origin: org.vert-x/vertx-core
public void handle(HttpServerRequest req) {
if (log.isTraceEnabled()) log.trace("In Info handler");
req.response.headers().put("Content-Type", "application/json; charset=UTF-8");
req.response.headers().put("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0");
JsonObject json = new JsonObject();
json.putBoolean("websocket", websocket);
json.putBoolean("cookie_needed", config.getBoolean("insert_JSESSIONID"));
json.putArray("origins", new JsonArray().add("*:*"));
// Java ints are signed, so we need to use a long and add the offset so
// the result is not negative
json.putNumber("entropy", RAND_OFFSET + new Random().nextInt());
setCORS(req);
req.response.end(json.encode());
}
};
代码示例来源:origin: net.kuujo/xync
@Override
public void start() {
this.haInfo = new JsonObject();
haInfo.putString("node", nodeID);
haInfo.putString("group", group);
this.deployments = new JsonArray();
haInfo.putArray("deployments", deployments);
this.deploymentIDs = new JsonObject();
haInfo.putObject("external", deploymentIDs);
this.internalIDs = new JsonObject();
haInfo.putObject("internal", internalIDs);
clusterMap.put(node, haInfo.encode());
}
代码示例来源:origin: net.kuujo/xync
/**
* Handles map keys command.
*/
private void doMapKeys(final Message<JsonObject> message) {
final String name = message.body().getString("name");
if (name == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified."));
return;
}
try {
Set<Object> result = manager.getMap(formatKey(name)).keySet();
message.reply(new JsonObject().putString("status", "ok").putArray("result", new JsonArray(result.toArray())));
} catch (Exception e) {
message.reply(new JsonObject().putString("status", "error").putString("message", e.getMessage()));
}
}
代码示例来源:origin: net.kuujo/xync
/**
* Handles map values command.
*/
private void doMapValues(final Message<JsonObject> message) {
final String name = message.body().getString("name");
if (name == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified."));
return;
}
try {
Collection<Object> result = manager.getMap(formatKey(name)).values();
message.reply(new JsonObject().putString("status", "ok").putArray("result", new JsonArray(result.toArray())));
} catch (Exception e) {
message.reply(new JsonObject().putString("status", "error").putString("message", e.getMessage()));
}
}
代码示例来源:origin: org.vert-x/vertx-core
enabledTransports.add(Transport.WEBSOCKET.toString());
enabledTransports.add(Transport.XHR.toString());
for (Object tr : config.getArray("disabled_transports", new JsonArray())) {
enabledTransports.remove(tr);
代码示例来源:origin: com.englishtown/vertx-mod-hk2
bootstrapNames = (JsonArray) field;
} else {
bootstrapNames = new JsonArray().add((field == null ? BOOTSTRAP_BINDER_NAME : field));
代码示例来源:origin: OlivierCroisier/LP4J
/**
* Constructor.
*
* @param httpPort The HTTP port on which the emulator should run.
*/
public EmulatorLaunchpad(int httpPort) {
vertx = VertxFactory.newVertx();
// Static files
HttpServer httpServer = vertx.createHttpServer();
httpServer.requestHandler(new WebResourceHandler());
// Eventbus bridge
JsonObject bridgeConfig = new JsonObject().putString("prefix", EVENTBUS_ADDRESS);
JsonArray credentialsPermitAll = new JsonArray().add(new JsonObject());
vertx.createSockJSServer(httpServer).bridge(bridgeConfig, credentialsPermitAll, credentialsPermitAll);
vertx.eventBus().registerLocalHandler(EVENTBUS_SERVER_HANDLER_ID, eventBusHandler);
System.out.println("Launchpad emulator is ready on http://localhost:" + httpPort + "/");
httpServer.listen(httpPort);
}
代码示例来源:origin: io.vertx/vertx-platform
this.enabled = enabled;
this.haInfo = new JsonObject();
this.haMods = new JsonArray();
haInfo.putArray("mods", haMods);
haInfo.putString("group", this.group);
代码示例来源:origin: vert-x/mod-lang-php
JsonArray json = new JsonArray();
Iterator<Value> iter = array.getValueIterator(env);
while (iter.hasNext()) {
代码示例来源:origin: io.vertx/mod-web-server
if (bridge) {
SockJSServer sjsServer = vertx.createSockJSServer(server);
JsonArray inboundPermitted = getOptionalArrayConfig("inbound_permitted", new JsonArray());
JsonArray outboundPermitted = getOptionalArrayConfig("outbound_permitted", new JsonArray());
代码示例来源:origin: org.vert-x/vertx-core
private JsonObject setDefaults(JsonObject config) {
config = config.copy();
//Set the defaults
if (config.getNumber("session_timeout") == null) {
config.putNumber("session_timeout", 5 * 1000); // 5 seconds default
}
if (config.getBoolean("insert_JSESSIONID") == null) {
config.putBoolean("insert_JSESSIONID", true);
}
if (config.getNumber("heartbeat_period") == null) {
config.putNumber("heartbeat_period", 5l * 1000);
}
if (config.getNumber("max_bytes_streaming") == null) {
config.putNumber("max_bytes_streaming", 128 * 1024);
}
if (config.getString("prefix") == null) {
config.putString("prefix", "/");
}
if (config.getString("library_url") == null) {
config.putString("library_url", "http://cdn.sockjs.org/sockjs-0.2.1.min.js");
}
if (config.getArray("disabled_transports") == null) {
config.putArray("disabled_transports", new JsonArray());
}
return config;
}
代码示例来源:origin: com.englishtown/vertx-mod-cassandra
JsonArray arr = new JsonArray();
json.putArray("seeds", arr);
if (seeds != null) {
代码示例来源:origin: org.apache.activemq/artemis-vertx-integration
break;
case VertxConstants.TYPE_JSON_ARRAY:
vertxMsgBody = new JsonArray(bodyBuffer.readString());
break;
case VertxConstants.TYPE_REPLY_FAILURE:
代码示例来源:origin: org.vert-x/vertx-core
JsonArray disabled = new JsonArray();
disabled.add(Transport.WEBSOCKET.toString());
installApp(new JsonObject().putString("prefix", "/disabled_websocket_echo")
内容来源于网络,如有侵权,请联系作者删除!