当前位置: 首页>>代码示例>>Java>>正文


Java JsonObject.forEach方法代码示例

本文整理汇总了Java中io.vertx.core.json.JsonObject.forEach方法的典型用法代码示例。如果您正苦于以下问题:Java JsonObject.forEach方法的具体用法?Java JsonObject.forEach怎么用?Java JsonObject.forEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.json.JsonObject的用法示例。


在下文中一共展示了JsonObject.forEach方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: packMetaData

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
/**
 * 封装metadata为Buffer。
 * 
 * @param meta meta
 * @param charset charset
 * @return Buffer
 */
public static Buffer packMetaData(JsonObject meta, String charset) {
	StringBuilder builder = new StringBuilder();

	meta.forEach(pair -> {
		builder.append(pair.getKey());
		builder.append(FDFS_FIELD_SEPERATOR);
		builder.append(pair.getValue());
		builder.append(FDFS_RECORD_SEPERATOR);
	});

	if (builder.length() > 0) {
		builder.deleteCharAt(builder.length() - 1);
	}

	return Buffer.buffer(builder.toString(), charset);
}
 
开发者ID:gengteng,项目名称:vertx-fastdfs-client,代码行数:24,代码来源:FdfsProtocol.java

示例2: apply

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
public Mirror apply(final Function<String, String> function) {
    final JsonObject result = this.data.copy();
    result.forEach((entry) ->
            this.converted.put(function.apply(entry.getKey()),
                    entry.getValue()));
    return this;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:8,代码来源:Mirror.java

示例3: get

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
public void get(String uri, JsonObject param, Handler<AsyncResult<HttpResponse<Buffer>>> h) {

		HttpRequest<Buffer> req = app.webclient.get(this.port,this.host, uri)
				.timeout(app.timeout);
		if(param!=null){
			param.forEach(entry -> {
				req.addQueryParam(entry.getKey(), "" + entry.getValue());
			});
		}		
		
		Handler<AsyncResult<HttpResponse<Buffer>>> callback =res->{
			if(res.succeeded()){				
				continueFailTimes=0;		
				log.info("{}, {} http://{}:{}{}",app.name,HttpMethod.GET,this.host,this.port,uri);			
				h.handle(Future.succeededFuture(res.result()));			
			}else{
				Throwable t = res.cause();
				this.onException(t, uri);
				h.handle(Future.failedFuture(t));				
			}		
		};
		
//		taskInProcessing=taskInProcessing+1;
		if(this.breaker!=null){
			breaker.<HttpResponse<Buffer>>execute(f->{
				req.send(f);
			}).setHandler(callback);	
		}else{			
			req.send(callback);
		}
				
	}
 
开发者ID:troopson,项目名称:etagate,代码行数:33,代码来源:Node.java

示例4: start

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
/**
 * Entry point method which starts the server event loop and initializes
 * our current OMERO.web session store.
 */
@Override
public void start(Future<Void> future) {
    log.info("Starting verticle");

    if (config().getBoolean("debug")) {
        Logger root = (Logger) LoggerFactory.getLogger(
                "com.glencoesoftware.omero.ms");
        root.setLevel(Level.DEBUG);
    }

    // Set OMERO.server configuration options using system properties
    JsonObject omeroServer = config().getJsonObject("omero.server");
    omeroServer.forEach(entry -> {
        System.setProperty(entry.getKey(), (String) entry.getValue());
    });

    context = new ClassPathXmlApplicationContext(
            "classpath:ome/config.xml",
            "classpath:ome/services/datalayer.xml",
            "classpath*:beanRefContext.xml");

    // Deploy our dependency verticles
    JsonObject omero = config().getJsonObject("omero");
    vertx.deployVerticle(new PixelBufferVerticle(
            omero.getString("host"), omero.getInteger("port"), context),
            new DeploymentOptions().setWorker(
                    true).setMultiThreaded(true));

    HttpServer server = vertx.createHttpServer();
    Router router = Router.router(vertx);

    // Cookie handler so we can pick up the OMERO.web session
    router.route().handler(CookieHandler.create());

    // OMERO session handler which picks up the session key from the
    // OMERO.web session and joins it.
    JsonObject redis = config().getJsonObject("redis");
    sessionStore = new OmeroWebRedisSessionStore(redis.getString("uri"));
    router.route().handler(
            new OmeroWebSessionRequestHandler(sessionStore));

    // Pixel buffer request handlers
    router.get(
            "/tile/:imageId/:z/:c/:t")
        .handler(this::getTile);

    int port = config().getInteger("port");
    log.info("Starting HTTP server *:{}", port);
    server.requestHandler(router::accept).listen(port, result -> {
        if (result.succeeded()) {
            future.complete();
        } else {
            future.fail(result.cause());
        }
    });
}
 
开发者ID:glencoesoftware,项目名称:omero-ms-pixel-buffer,代码行数:61,代码来源:PixelBufferMicroserviceVerticle.java

示例5: toMap

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private static Map<String, Object> toMap(JsonObject json) {
  Map<String, Object> map = new LinkedHashMap<>();
  json.forEach(entry -> map.put(entry.getKey(), entry.getValue().toString()));
  return map;
}
 
开发者ID:cescoffier,项目名称:fluid,代码行数:6,代码来源:KafkaSink.java

示例6: toMap

import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private static Map<String, String> toMap(JsonObject json) {
  Map<String, String> map = new LinkedHashMap<>();
  json.forEach(entry -> map.put(entry.getKey(), entry.getValue().toString()));
  return map;
}
 
开发者ID:cescoffier,项目名称:fluid,代码行数:6,代码来源:KafkaSource.java


注:本文中的io.vertx.core.json.JsonObject.forEach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。