あなただけでなく、それはそれが行われている通常の方法です。
final Pattern chatUrlPattern = Pattern.compile("/ebus/(\\w+)");
final EventBus eventBus = this.vertx.eventBus();
final Router router = Router.router(this.vertx);
// Or wherever your static content is
router.route("web/*").handler(StaticHandler.create());
this.vertx.createHttpServer().websocketHandler(ws -> {
final Matcher m = chatUrlPattern.matcher(ws.path());
if (!m.matches()) {
ws.reject();
return;
}
/* Your code here */
}
// Your Jersey code here, for example:
vertx.runOnContext(aVoid -> {
// Set up the jersey configuration
// The minimum config required is a package to inspect for JAX-RS endpoints
vertx.getOrCreateContext().config()
.put("jersey", new JsonObject()
.put("port", 8080)
.put("packages", new JsonArray()
.add(HelloWorldEndpoint.class.getPackage().getName())));
// Use a service locator (HK2 or Guice are supported by default) to create the jersey server
ServiceLocator locator = ServiceLocatorUtilities.bind(new HK2JerseyBinder(), new HK2VertxBinder(vertx));
JerseyServer server = locator.getService(JerseyServer.class);
// Start the server which simply returns "Hello World!" to each GET request.
server.start();
});
ありがとう、私はJerseyVerticleと積み重ねられました、あなたは私に良い方向を指摘しました。 –