本文整理汇总了Java中org.vertx.java.core.Handler.handle方法的典型用法代码示例。如果您正苦于以下问题:Java Handler.handle方法的具体用法?Java Handler.handle怎么用?Java Handler.handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vertx.java.core.Handler
的用法示例。
在下文中一共展示了Handler.handle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatSearchResult
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
private void formatSearchResult(final JsonArray results, final JsonArray columnsHeader, final Handler<Either<String, JsonArray>> handler) {
final List<String> aHeader = columnsHeader.toList();
final JsonArray traity = new JsonArray();
if (results.size() == 0) {
handler.handle(new Right<String, JsonArray>(traity));
} else {
for (int i = 0; i < results.size(); i++) {
final JsonObject j = results.get(i);
final JsonObject jr = new JsonObject();
if (j != null) {
jr.putString(aHeader.get(0), j.getString("name"));
jr.putString(aHeader.get(1), j.getString("description", ""));
jr.putObject(aHeader.get(2), j.getObject("modified"));
jr.putString(aHeader.get(3), j.getObject("owner").getString("displayName"));
jr.putString(aHeader.get(4), j.getObject("owner").getString("userId"));
jr.putString(aHeader.get(5), "/collaborativeeditor#/view/" + j.getString("_id"));
traity.add(jr);
}
}
handler.handle(new Right<String, JsonArray>(traity));
}
}
示例2: authorize
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public void authorize(HttpServerRequest request, Binding binding, UserInfos user, Handler<Boolean> handler) {
String sharedMethod = binding.getServiceMethod().replaceAll("\\.", "-");
String id = request.params().get(conf.getResourceIdLabel());
if (id != null && !id.trim().isEmpty()) {
List<DBObject> groups = new ArrayList<>();
groups.add(QueryBuilder.start("userId").is(user.getUserId())
.put(sharedMethod).is(true).get());
for (String gpId: user.getGroupsIds()) {
groups.add(QueryBuilder.start("groupId").is(gpId)
.put(sharedMethod).is(true).get());
}
QueryBuilder query = QueryBuilder.start("_id").is(id).or(
QueryBuilder.start("owner.userId").is(user.getUserId()).get(),
QueryBuilder.start("visibility").is(VisibilityFilter.PUBLIC.name()).get(),
QueryBuilder.start("visibility").is(VisibilityFilter.PROTECTED.name()).get(),
QueryBuilder.start("shared").elemMatch(
new QueryBuilder().or(groups.toArray(new DBObject[groups.size()])).get()).get()
);
MongoAppFilter.executeCountQuery(request, conf.getCollection(),
MongoQueryBuilder.build(query), 1, handler);
} else {
handler.handle(false);
}
}
示例3: handleFailure
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
private void handleFailure(
final HttpConnection connection,
final HttpClientResponse response,
final Handler<Boolean> handler) {
if (response.statusCode() < HTTP_SUCCESS_CODE
|| response.statusCode() >= HTTP_REDIRECTION_CODE) {
connection.disconnect();
if (handler != null) {
handler.handle(FALSE);
}
m_logger.error("Ignoring host: {}",
connection.getAddress(),
new IllegalStateException("Connection failure: "
+ response.statusCode()
+ "/"
+ response.statusMessage()));
}
}
示例4: parseData
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
private void parseData(HttpClientResponse response, final Handler<JsonObject> handler) {
if (response.statusCode() == 200) {
final Buffer buff = new Buffer();
response.dataHandler(new Handler<Buffer>() {
@Override
public void handle(Buffer event) {
buff.appendBuffer(event);
}
});
response.endHandler(new Handler<Void>() {
@Override
public void handle(Void end) {
handleResponse(buff.toString(), handler);
}
});
} else {
handler.handle(new JsonObject().putString("status", "error").putString("message", response.statusMessage()));
}
}
示例5: onFailure
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
private void onFailure(Throwable error) {
failed = true;
Handler<Throwable> handler = plainExceptionHandler;
if( handler!=null ) {
handler.handle(error);
}
}
示例6: snoopConnectionParameters
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public void snoopConnectionParameters(final SocketWrapper socket, final Buffer received, final Handler<ConnectionParameters> handler) {
// We can't yet snoop the virtual host info from a AMQP connection..
final AmqpProtocolDecoder h = new AmqpProtocolDecoder(this);
handler.handle(new ConnectionParameters());
}
示例7: searchResource
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public void searchResource(List<String> appFilters, String userId, JsonArray groupIds, JsonArray searchWords, Integer page, Integer limit,
final JsonArray columnsHeader, final String locale, final Handler<Either<String, JsonArray>> handler) {
if (appFilters.contains(ShareBigFilesSearchingEvents.class.getSimpleName())) {
final List<String> returnFields = new ArrayList<String>();
returnFields.add("fileNameLabel");
returnFields.add("description");
returnFields.add("modified");
returnFields.add("owner.userId");
returnFields.add("owner.displayName");
searchService.search(userId, groupIds.toList(), returnFields, searchWords.toList(), page, limit, new Handler<Either<String, JsonArray>>() {
@Override
public void handle(Either<String, JsonArray> event) {
if (event.isRight()) {
final JsonArray res = formatSearchResult(event.right().getValue(), columnsHeader, locale);
handler.handle(new Right<String, JsonArray>(res));
} else {
handler.handle(new Either.Left<String, JsonArray>(event.left().getValue()));
}
if (log.isDebugEnabled()) {
log.debug("[ShareBigFilesSearchingEvents][searchResource] The resources searched by user are finded");
}
}
});
} else {
handler.handle(new Right<String, JsonArray>(new JsonArray()));
}
}
示例8: getNow
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClient getNow(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return this;
}
httpClient.getNow(s, handler);
return this;
}
示例9: options
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest options(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.options(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例10: get
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest get(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.get(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例11: post
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest post(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.post(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例12: put
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest put(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.put(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例13: delete
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest delete(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.delete(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例14: trace
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest trace(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.trace(s, handler);
preConfigureRequest(handler, req);
return req;
}
示例15: connect
import org.vertx.java.core.Handler; //导入方法依赖的package包/类
@Override
public HttpClientRequest connect(String s, Handler<HttpClientResponse> handler) {
if (httpClient == null) {
handler.handle(new ErrorHttpClientResponse(500, ""));
return null;
}
final HttpClientRequest req = httpClient.connect(s, handler);
preConfigureRequest(handler, req);
return req;
}