seems to work?
This commit is contained in:
parent
53821aa5f6
commit
e60cbe1143
|
@ -1 +1,2 @@
|
||||||
.gradle
|
.gradle
|
||||||
|
build
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="1.8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="useQualifiedModuleNames" value="true" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,25 @@
|
||||||
|
apply plugin: 'java'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
// configuration that holds jars to include in the jar
|
||||||
|
extraLibs
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
extraLibs group: 'org.takes', name: 'takes', version: '1.19'
|
||||||
|
extraLibs group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
|
||||||
|
extraLibs group: 'org.glassfish', name: 'javax.json', version: '1.1.4'
|
||||||
|
|
||||||
|
|
||||||
|
configurations.compile.extendsFrom(configurations.extraLibs)
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from {
|
||||||
|
configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.rusefi;
|
||||||
|
|
||||||
|
import org.takes.Take;
|
||||||
|
import org.takes.facets.fork.FkRegex;
|
||||||
|
import org.takes.facets.fork.TkFork;
|
||||||
|
import org.takes.http.*;
|
||||||
|
import org.takes.rs.RsJson;
|
||||||
|
|
||||||
|
import javax.json.Json;
|
||||||
|
import javax.json.JsonObjectBuilder;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class Hello {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
AtomicInteger counter = new AtomicInteger();
|
||||||
|
|
||||||
|
int httpPort = 443;
|
||||||
|
System.out.println("hello on port " + 443);
|
||||||
|
|
||||||
|
|
||||||
|
Take forkTake = new TkFork(
|
||||||
|
new FkRegex("/", "hello takes"),
|
||||||
|
new FkRegex("/counter", (Take) req -> {
|
||||||
|
JsonObjectBuilder applicationObject = Json.createObjectBuilder();
|
||||||
|
applicationObject.add("counter", counter.incrementAndGet());
|
||||||
|
return new RsJson(applicationObject.build());
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// yes, I start insecure http on port 443, that's the place
|
||||||
|
Front frontEnd = new FtBasic(new BkParallel(new BkSafe(new BkBasic(forkTake)), 4), httpPort);
|
||||||
|
frontEnd.start(Exit.NEVER);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue