本文整理汇总了Java中org.vertx.java.core.http.RouteMatcher类的典型用法代码示例。如果您正苦于以下问题:Java RouteMatcher类的具体用法?Java RouteMatcher怎么用?Java RouteMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RouteMatcher类属于org.vertx.java.core.http包,在下文中一共展示了RouteMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: routeMatcher
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
public RouteMatcher routeMatcher(final EventBus eb) {
RouteMatcher router = new RouteMatcher();
router.get("/command/:id", new Handler<HttpServerRequest>() {
public void handle(final HttpServerRequest req) {
System.out.println("Command introduced: " + req.params().get("id"));
HashMap<String, Object> maps = new HashMap<>();
maps.put("socketID", "Alienware");
maps.put("command", req.params().get("id"));
JsonObject json = new JsonObject(maps);
eb.publish("send-ws-message", json);
req.response().end();
// req.response().putHeader("Content-Type", "application/json");
// req.response().end(data.encodePrettily());
// and call the event we want to use
//eb.send("mongodb-persistor", json, new ReplyHandler(req, data));
}
});
return router;
}
示例2: init
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
public void init(Vertx vertx, Container container, RouteMatcher rm,
Map<String, SecuredAction> securedActions) {
super.vertx = vertx;
super.container = container;
super.rm = rm;
super.securedActions = securedActions;
super.eb = Server.getEventBus(vertx);
if (pathPrefix == null) {
super.pathPrefix = Server.getPathPrefix(container.config());
}
if (rm != null) {
loadRoutes();
} else {
log.error("RouteMatcher is null.");
}
}
示例3: start
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
public void start() {
RouteMatcher routeMatcher = new RouteMatcher();
// HTTP server
HttpServer httpServer = vertx.createHttpServer();
httpServer.requestHandler(routeMatcher);
// SockJS server
JsonArray permitted = new JsonArray();
permitted.add(new JsonObject()); // Let everything through
SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
sockJSServer.bridge(new JsonObject().putString("prefix", "/eventbus"), permitted, permitted);
httpServer.listen(7777);
System.out.println("Vert.X Core UP");
}
示例4: startServer
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
protected void startServer(int port, Action<ServerHttpExchange> requestAction) throws Exception {
server = VertxFactory.newVertx().createHttpServer();
RouteMatcher matcher = new RouteMatcher();
matcher.all(TEST_URI, new AsityRequestHandler().onhttp(requestAction));
server.requestHandler(matcher);
server.listen(port);
}
示例5: init
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
public void init(Vertx vertx, final Container container, RouteMatcher rm,
Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
super.init(vertx, container, rm, securedActions);
ConcurrentSharedMap<Object, Object> server = vertx.sharedData().getMap("server");
Boolean cluster = (Boolean) server.get("cluster");
if (Boolean.TRUE.equals(cluster)) {
ClusterManager cm = ((VertxInternal) vertx).clusterManager();
cursusMap = cm.getSyncMap("cursusMap");
} else {
cursusMap = new HashMap<>();
}
/*
service.refreshToken(new Handler<Boolean>() {
public void handle(Boolean res) {
if(!res)
log.error("[Cursus][refreshToken] Error while retrieving the Token.");
else
log.info("[Cursus][refreshToken] Token refreshed.");
}
});
*/
if(cursusMap.containsKey("wallets"))
return;
service.refreshWallets(new Handler<Boolean>() {
public void handle(Boolean res) {
if(!res)
log.error("[Cursus][refreshWallets] Error while retrieving the wallets list.");
else
log.info("[Cursus][refreshWallets] Wallets list refreshed.");
}
});
}
示例6: getMatcher
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
/**
* Construct a RouteMatcher for the supported routes
*
* @param activeProfilers The active profilers
* @return A RouteMatcher that matches all supported routes
*/
public static RouteMatcher getMatcher(final Map<String, ScheduledFuture<?>> runningProfilers, Map<String, Profiler> activeProfilers, AtomicReference<Boolean> isRunning, List<String> errors) {
RouteMatcher matcher = new RouteMatcher();
matcher.get("/profilers", RequestHandler.handleGetProfilers(runningProfilers));
matcher.get("/disable/:profiler", RequestHandler.handleDisableProfiler(runningProfilers));
matcher.get("/status/profiler/:profiler", RequestHandler.handleProfilerStatus(activeProfilers));
matcher.get("/errors", RequestHandler.handleErrorMessages(errors));
matcher.get("/isRunning", RequestHandler.isRunning(isRunning));
return matcher;
}
示例7: HttpServer
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
public HttpServer(final JsonObject conf, final RxVertx rx)
{
final RouteMatcher routeMatcher = newRouteMatcher(conf, rx);
final RxHttpServer httpServer = rx.createHttpServer();
httpServer.http().subscribe(req -> routeMatcher.handle(req));
httpServer.websocket().subscribe(ws -> handleWebSocket(ws, conf, rx));
final int httpPort = conf.getObject("http").getInteger("port");
final String httpHost = conf.getObject("http").getString("host");
httpServer.coreHttpServer().listen(httpPort, httpHost);
}
示例8: startServer
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
protected void startServer() {
server = VertxFactory.newVertx().createHttpServer();
RouteMatcher matcher = new RouteMatcher();
matcher.all("/test", new VibeRequestHandler().onhttp(performer.serverAction()));
server.requestHandler(matcher);
server.listen(port);
}
示例9: VertX
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
private VertX() {
final AppConfig config = AppConfig.getInstance();
vertx = VertxFactory.newVertx();
server = vertx.createHttpServer();
routeMatcher = new RouteMatcher();
server.requestHandler(routeMatcher);
server.listen(config.getInteger("webservice.port", DEFAULT_PORT));
}
示例10: run
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
private void run() throws Exception {
Vertx vertx = new DefaultVertx();
HttpServer server = vertx.createHttpServer();
RouteMatcher routeMatcher = new RouteMatcher();
routeMatcher.allWithRegEx("/jimix(.*)", new JimixVertxHandler());
server.requestHandler(routeMatcher).listen(8080, "localhost");
while (true) {
Thread.sleep(10000);
}
}
示例11: Controller
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
public Controller(Vertx vertx, Container container, RouteMatcher rm,
Map<String, SecuredAction> securedActions) {
super(vertx, container);
this.rm = rm;
this.uriBinding = new HashMap<>();
this.securedActions = securedActions;
if (vertx != null) {
this.eb = Server.getEventBus(vertx);
}
if (rm != null) {
loadRoutes();
}
this.accessLogger = new AccessLogger();
}
示例12: VertX
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
private VertX() {
final AppConfig config = AppConfig.getInstance();
vertx = VertxFactory.newVertx();
server = vertx.createHttpServer();
routeMatcher = new RouteMatcher();
server.requestHandler(routeMatcher);
sockJsServer = vertx.createSockJSServer(server);
registerNomatchHandler();
server.listen(config.getInteger("webservice.webport", 8080));
LOG.debug("VertX initialized");
}
示例13: init
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
public void init(Vertx vertx, Container container, RouteMatcher rm,
Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
super.init(vertx, container, rm, securedActions);
eventStore = EventStoreFactory.getFactory().getEventStore(ShareBigFiles.class.getSimpleName());
}
示例14: init
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
public void init(Vertx vertx, Container container, RouteMatcher rm,
Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
super.init(vertx, container, rm, securedActions);
eventStore = EventStoreFactory.getFactory().getEventStore(Community.class.getSimpleName());
}
示例15: init
import org.vertx.java.core.http.RouteMatcher; //导入依赖的package包/类
@Override
public void init(Vertx vertx, Container container, RouteMatcher rm,
Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
super.init(vertx, container, rm, securedActions);
eventStore = EventStoreFactory.getFactory().getEventStore(Community.class.getSimpleName());
}