This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package counter; | |
import io.vertx.core.Launcher; | |
// for easier debugging and running the app from IDE | |
public class App { | |
public static void main(final String[] args) { | |
Launcher.executeCommand("run", CounterVerticle.class.getName()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java' | |
id 'application' | |
id 'com.github.johnrengelman.shadow' version '2.0.2' | |
} | |
repositories { | |
mavenCentral() | |
} | |
group 'vertx-sockjs-counter' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package counter; | |
import io.vertx.core.Handler; | |
import io.vertx.core.eventbus.EventBus; | |
import io.vertx.core.logging.Logger; | |
import io.vertx.core.logging.LoggerFactory; | |
import io.vertx.ext.bridge.BridgeEventType; | |
import io.vertx.ext.web.handler.sockjs.BridgeEvent; | |
import java.util.Optional; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package counter; | |
import io.vertx.core.shareddata.LocalMap; | |
import io.vertx.core.shareddata.SharedData; | |
import java.util.Optional; | |
public class CounterRepository { | |
private SharedData data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package counter; | |
import io.vertx.core.AbstractVerticle; | |
import io.vertx.core.eventbus.EventBus; | |
import io.vertx.core.shareddata.SharedData; | |
import io.vertx.ext.bridge.PermittedOptions; | |
import io.vertx.ext.web.Router; | |
import io.vertx.ext.web.handler.StaticHandler; | |
import io.vertx.ext.web.handler.sockjs.BridgeOptions; | |
import io.vertx.ext.web.handler.sockjs.SockJSHandler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Vert.x with SockJS</title> | |
<script src="//cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js"></script> | |
<script src="js/vertx-eventbus.js"></script> | |
<script src="js/app.js"></script> | |
</head> | |
<body onload="init();"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
registerHandler(); | |
} | |
let eventBus; | |
function registerHandler() { | |
eventBus = new EventBus('http://localhost:8080/eventbus'); | |
eventBus.onopen = function () { | |
eventBus.registerHandler('out', function (error, message) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List excludedGroovyClasses() { | |
String srcDir = System.getProperty("user.dir") + "/src/main/groovy/" | |
FileTree tree = fileTree(dir: 'src/main/groovy') | |
tree.include '**/*.groovy' | |
String immutableSign = 'import groovy.transform.Immutable' | |
Collection excludedClasses = tree.findAll { | |
it.text.contains(immutableSign) | |
}.collect { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.app | |
import org.springframework.boot.SpringApplication | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.context.annotation.ComponentScan | |
@SpringBootApplication | |
@ComponentScan(["com.rest"]) | |
class RestApp { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum State { | |
A, B, C | |
} | |
class Test { | |
State a() { | |
"A" | |
} | |
} | |