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


Java RouteMatcher类代码示例

本文整理汇总了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;
    }
 
开发者ID:jlarriba,项目名称:jdashboard,代码行数:22,代码来源:RestFacade.java

示例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.");
	}
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:17,代码来源:BaseController.java

示例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");
    }
 
开发者ID:rvillars,项目名称:bookapp-cqrs,代码行数:19,代码来源:VertXBean.java

示例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);
}
 
开发者ID:cettia,项目名称:asity,代码行数:9,代码来源:VertxServerHttpExchangeTest.java

示例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.");
		}
	});

}
 
开发者ID:OPEN-ENT-NG,项目名称:cursus,代码行数:37,代码来源:CursusController.java

示例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;
}
 
开发者ID:etsy,项目名称:statsd-jvm-profiler,代码行数:16,代码来源:RequestHandler.java

示例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);
}
 
开发者ID:ddossot,项目名称:vertx-react-demo,代码行数:14,代码来源:HttpServer.java

示例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);
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:9,代码来源:VertxServerHttpExchangeTest.java

示例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));
}
 
开发者ID:bwinparty,项目名称:knbnprxy,代码行数:9,代码来源:VertX.java

示例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);
    }
}
 
开发者ID:manuel-woelker,项目名称:jimix,代码行数:14,代码来源:JimixSampleVertxMain.java

示例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();
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:15,代码来源:Controller.java

示例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");
}
 
开发者ID:zyclonite,项目名称:gw2live,代码行数:12,代码来源:VertX.java

示例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());
}
 
开发者ID:OPEN-ENT-NG,项目名称:share-big-files,代码行数:7,代码来源:ShareBigFilesController.java

示例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());
}
 
开发者ID:OPEN-ENT-NG,项目名称:community,代码行数:7,代码来源:PagesController.java

示例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());
}
 
开发者ID:OPEN-ENT-NG,项目名称:community,代码行数:7,代码来源:CommunityController.java


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