• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VoidHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.vertx.java.core.VoidHandler的典型用法代码示例。如果您正苦于以下问题:Java VoidHandler类的具体用法?Java VoidHandler怎么用?Java VoidHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VoidHandler类属于org.vertx.java.core包,在下文中一共展示了VoidHandler类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderView

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
public void renderView(final HttpServerRequest request, JsonObject params,
		String resourceName, Reader r, final int status) {
	processTemplate(request, params, resourceName, r, new Handler<Writer>() {
		@Override
		public void handle(final Writer writer) {
			if (writer != null) {
				request.response().putHeader("content-type", "text/html; charset=utf-8");
				request.response().setStatusCode(status);
				if (hookRenderProcess != null) {
					executeHandlersHookRender(request, new VoidHandler() {
						@Override
						protected void handle() {
							request.response().end(writer.toString());
						}
					});
				} else {
					request.response().end(writer.toString());
				}
			} else {
				renderError(request);
			}
		}
	});
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:25,代码来源:Renders.java


示例2: VertxServerWebSocket

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
public VertxServerWebSocket(org.vertx.java.core.http.ServerWebSocket socket) {
  this.socket = socket;
  socket.closeHandler(new VoidHandler() {
    @Override
    protected void handle() {
      closeActions.fire();
    }
  })
  .exceptionHandler(new Handler<Throwable>() {
    @Override
    public void handle(Throwable throwable) {
      errorActions.fire(throwable);
    }
  })
  .frameHandler(new Handler<WebSocketFrame>() {
    @Override
    public void handle(WebSocketFrame f) {
      // Deal with only data frames
      WebSocketFrameInternal frame = (WebSocketFrameInternal) f;
      switch (frame.type()) {
        case TEXT:
          textActions.fire(frame.textData());
          break;
        case BINARY:
          binaryActions.fire(frame.getBinaryData().nioBuffer());
          break;
        default:
          break;
      }
    }
  });
}
 
开发者ID:cettia,项目名称:asity,代码行数:33,代码来源:VertxServerWebSocket.java


示例3: doRead

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
@Override
protected void doRead(final Action<ByteBuffer> chunkAction) {
  request.dataHandler(new Handler<Buffer>() {
    @Override
    public void handle(Buffer body) {
      chunkAction.on(body.getByteBuf().nioBuffer());
    }
  })
  .endHandler(new VoidHandler() {
    @Override
    protected void handle() {
      endActions.fire();
    }
  });
}
 
开发者ID:cettia,项目名称:asity,代码行数:16,代码来源:VertxServerHttpExchange.java


示例4: VertxServerWebSocket

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
public VertxServerWebSocket(org.vertx.java.core.http.ServerWebSocket socket) {
    this.socket = socket;
    socket.closeHandler(new VoidHandler() {
        @Override
        protected void handle() {
            closeActions.fire();
        }
    })
    .exceptionHandler(new Handler<Throwable>() {
        @Override
        public void handle(Throwable throwable) {
            errorActions.fire(throwable);
        }
    })
    .frameHandler(new Handler<WebSocketFrame>() {
        @Override
        public void handle(WebSocketFrame f) {
            // Deal with only data frames
            WebSocketFrameInternal frame = (WebSocketFrameInternal) f;
            switch (frame.type()) {
            case TEXT:
                textActions.fire(frame.textData());
                break;
            case BINARY:
                binaryActions.fire(frame.getBinaryData().nioBuffer());
                break;
            default:
                break;
            }
        }
    });
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:33,代码来源:VertxServerWebSocket.java


示例5: doRead

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
@Override
protected void doRead(final Action<ByteBuffer> chunkAction) {
    request.dataHandler(new Handler<Buffer>() {
        @Override
        public void handle(Buffer body) {
            chunkAction.on(body.getByteBuf().nioBuffer());
        }
    })
    .endHandler(new VoidHandler() {
        @Override
        protected void handle() {
            endActions.fire();
        }
    });
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:16,代码来源:VertxServerHttpExchange.java


示例6: canAccess

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
@Override
public void canAccess(HttpServerRequest request, final Handler<Boolean> handler) {
	accessLogger.log(request, new VoidHandler() {
		@Override
		protected void handle() {
			handler.handle(true);
		}
	});
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:10,代码来源:AccessLoggerFilter.java


示例7: bodyToParams

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
/**
 * @deprecated Use request.formAttributes() instead
 * @param request http request
 * @param handler receive attributes
 */
public void bodyToParams(final HttpServerRequest request, final Handler<MultiMap> handler) {
	request.expectMultiPart(true);
	request.endHandler(new VoidHandler() {
		@Override
		protected void handle() {
			handler.handle(request.formAttributes());
		}
	});
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:15,代码来源:Server.java


示例8: executeHandlersHookRender

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
private void executeHandlersHookRender(final HttpServerRequest request, VoidHandler endHandler) {
	final VoidHandler[] handlers = new VoidHandler[hookRenderProcess.size() + 1];
	handlers[handlers.length - 1] = endHandler;
	for (int i = hookRenderProcess.size() - 1; i >= 0; i--) {
		final int j = i;
		handlers[i] = new VoidHandler() {
			@Override
			protected void handle() {
				hookRenderProcess.get(j).execute(request, handlers[j + 1]);
			}
		};
	}
	handlers[0].handle(null);
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:15,代码来源:Renders.java


示例9: handleSuccess

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
@Override
protected void handleSuccess(final HttpClientResponse response) {

    final Buffer body = new Buffer(0);

    response.dataHandler(new Handler<Buffer>() {
        @Override
        public void handle(final Buffer data) {
            body.appendBuffer(data);
        }
    });

    response.endHandler(new VoidHandler() {
        @Override
        public void handle() {
            //
            // Parse query response
            //
            String responseData = new String(body.getBytes(), StandardCharsets.UTF_8);
            logger().trace("Response: {}", responseData);
            JsonObject jsonData = new JsonObject(responseData);
            JsonArray items = jsonData.getArray(API_KEY_RESULTS, new JsonArray());
            boolean found = false;
            for (int i = 0; i < items.size(); i++) {
                JsonObject item = items.get(i);
                //
                // Handle existing item (datasource, variable, etc..)
                //
                m_resultHandler.handleResponse(item);
                found = true;
            }
            m_resultHandler.responseDone();
            //
            // Create new item (datasource, variable, etc..)
            //
            if (!found && m_data != null) {
                try {
                    logger().debug("Creating: {}", m_data.encode());
                    IConnection<HttpClient> connection = connections().next();
                    UbidotsPost postHandler = new UbidotsPost(
                            connection,
                            m_resultHandler,
                            query(),
                            token(),
                            m_data);
                    connection.doRequest(postHandler);

                } catch (ConnectionException e) {
                    logger().error("Failed to create datasource or variable", e);
                }
            }
        }
    });
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:55,代码来源:Ubidots.java


示例10: httpHealthCheck

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
private void httpHealthCheck(
        final HttpConnection connection,
        final HttpClientResponse response,
        final Handler<Boolean> handler) {

    m_logger.trace("Got response: {}/{}",
            response.statusCode(),
            response.statusMessage());

    if (response.statusCode() < HTTP_ERR_CODE) {

        final Buffer body = new Buffer(0);
        response.dataHandler(new Handler<Buffer>() {
            @Override
            public void handle(final Buffer data) {
                if (response.statusCode() >= HTTP_SUCCESS_CODE
                        && response.statusCode() < HTTP_REDIRECTION_CODE) {

                    body.appendBuffer(data);
                }
            }
        });
        response.endHandler(new VoidHandler() {
            @Override
            public void handle() {
                if (response.statusCode() >= HTTP_SUCCESS_CODE
                        && response.statusCode() < HTTP_REDIRECTION_CODE) {

                    String status = new String(body.getBytes(), StandardCharsets.UTF_8);
                    connection.setConnected(true);
                    if (handler != null) {
                        handler.handle(TRUE);
                    }
                    m_logger.trace("Connected to healthy host: {} ({})",
                            connection.getAddress(), status);
                } else {
                    handleFailure(connection, response, handler);
                }
            }
        });
    } else {
        handleFailure(connection, response, handler);
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:45,代码来源:DefaultHttpConnectionHealthChecker.java


示例11: verifyAndGet

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
public void verifyAndGet(final String token, final Handler<JsonObject> handler) {
	String[] t = token.split("\\.");
	if (t.length != 3) {
		handler.handle(null);
		return;
	}
	JsonObject header;
	try {
		header = new JsonObject(base64Decode(t[0]));
	} catch (UnsupportedEncodingException e) {
		log.error(e.getMessage(), e);
		handler.handle(null);
		return;
	}
	switch (Algorithm.valueOf(header.getString("alg"))) {
		case RS256:
		case RS384:
		case RS512:
			final String kid = header.getString("kid");
			if (kid != null) {
				PublicKey publicKey = certificates.get(kid);
				if (publicKey == null) {
					findCertificates(new VoidHandler() {
						@Override
						protected void handle() {
							handler.handle(verifyAndGet(token, certificates.get(kid)));
						}
					});
				} else {
					handler.handle(verifyAndGet(token, publicKey));
				}
			} else {
				log.error("missing key id");
				handler.handle(null);
			}
		break;
		case HS256:
			handler.handle(verifyAndGet(token, secret));
			break;
		default:
			log.error("Unsupported signature algorithm.");
	}

}
 
开发者ID:web-education,项目名称:web-utils,代码行数:45,代码来源:JWT.java


示例12: log

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
public void log(HttpServerRequest request, VoidHandler handler) {
	log.trace(formatLog(request));
	handler.handle(null);
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:5,代码来源:AccessLogger.java


示例13: execute

import org.vertx.java.core.VoidHandler; //导入依赖的package包/类
void execute(HttpServerRequest request, VoidHandler handler); 
开发者ID:web-education,项目名称:web-utils,代码行数:2,代码来源:HookProcess.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NativeClassQualifiedName类代码示例发布时间:2022-05-22
下一篇:
Java TintContextWrapper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap