public class VertxAtmosphere
extends java.lang.Object
public class VertxJerseyChat extends Verticle {
private static final Logger logger = LoggerFactory.getLogger(VertxJerseyChat.class);
public void start() throws Exception {
VertxAtmosphere.Builder b = new VertxAtmosphere.Builder();
HttpServer httpServer = vertx.createHttpServer();
httpServer.requestHandler(new Handler>HttpServerRequest<() {
public void handle(HttpServerRequest req) {
String path = req.path;
if (path.equals("/")) {
path = "/index.html";
}
logger.info("Servicing request {}", path);
req.response.sendFile("src/main/resources" + path);
}
});
b.resource(ResourceChat.class)
.initParam(ApplicationConfig.WEBSOCKET_CONTENT_TYPE, "application/json")
.httpServer(httpServer).url("/chat").build();
httpServer.listen(8080);
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
VertxAtmosphere.Builder |
| Modifier and Type | Method and Description |
|---|---|
AtmosphereCoordinator |
coordinator()
Return the bound @{link AtmosphereCoordinator}.
|
boolean |
matchPath(java.lang.String path)
Is the path match one of the resource deployed.
|
public AtmosphereCoordinator coordinator()
public boolean matchPath(java.lang.String path)
path - the resource path.Copyright © 2018. All Rights Reserved.