First commit
This commit is contained in:
44
.idea/libraries/io_javalin.xml
generated
44
.idea/libraries/io_javalin.xml
generated
@@ -1,28 +1,30 @@
|
|||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="io.javalin" type="repository">
|
<library name="io.javalin" type="repository">
|
||||||
<properties maven-id="io.javalin:javalin:6.3.0" />
|
<properties maven-id="io.javalin:javalin:4.6.8" />
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/6.3.0/javalin-6.3.0.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/4.6.8/javalin-4.6.8.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/2.0.16/slf4j-api-2.0.16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-server/11.0.23/jetty-server-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-server/9.4.51.v20230217/jetty-server-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-http/11.0.23/jetty-http-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-util/11.0.23/jetty-util-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-http/9.4.51.v20230217/jetty-http-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-io/11.0.23/jetty-io-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-util/9.4.51.v20230217/jetty-util-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/toolchain/jetty-jakarta-servlet-api/5.0.2/jetty-jakarta-servlet-api-5.0.2.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-io/9.4.51.v20230217/jetty-io-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-jetty-server/11.0.23/websocket-jetty-server-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-webapp/9.4.51.v20230217/jetty-webapp-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-servlet/11.0.23/jetty-servlet-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-xml/9.4.51.v20230217/jetty-xml-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-security/11.0.23/jetty-security-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-servlet/9.4.51.v20230217/jetty-servlet-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-webapp/11.0.23/jetty-webapp-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-security/9.4.51.v20230217/jetty-security-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-xml/11.0.23/jetty-xml-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-util-ajax/9.4.51.v20230217/jetty-util-ajax-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-jetty-api/11.0.23/websocket-jetty-api-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-server/9.4.51.v20230217/websocket-server-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-jetty-common/11.0.23/websocket-jetty-common-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-common/9.4.51.v20230217/websocket-common-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-core-common/11.0.23/websocket-core-common-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-api/9.4.51.v20230217/websocket-api-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-servlet/11.0.23/websocket-servlet-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-client/9.4.51.v20230217/websocket-client-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-core-server/11.0.23/websocket-core-server-11.0.23.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-client/9.4.51.v20230217/jetty-client-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.25/kotlin-stdlib-jdk8-1.9.25.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/websocket/websocket-servlet/9.4.51.v20230217/websocket-servlet-9.4.51.v20230217.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.25/kotlin-stdlib-1.9.25.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.32/kotlin-stdlib-jdk8-1.5.32.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.5.32/kotlin-stdlib-1.5.32.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.25/kotlin-stdlib-jdk7-1.9.25.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.5.32/kotlin-stdlib-common-1.5.32.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.5.32/kotlin-stdlib-jdk7-1.5.32.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
package ProtegeGX;
|
package ProtegeGX;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ProtegeGX {
|
public class ProtegeGX {
|
||||||
|
@Setter private Consumer<ProtegeData> onCardRead;
|
||||||
|
|
||||||
|
private void updateCardRead(String data) {
|
||||||
|
if (onCardRead != null) {
|
||||||
|
ProtegeData protegeData = new ProtegeData();
|
||||||
|
onCardRead.accept(protegeData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Disconnect() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package Web;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import io.javalin.Javalin;
|
import io.javalin.Javalin;
|
||||||
|
import io.javalin.http.staticfiles.Location;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -31,50 +32,40 @@ public class WebServer {
|
|||||||
Javalin app;
|
Javalin app;
|
||||||
public WebServer(){
|
public WebServer(){
|
||||||
app = Javalin.create(config -> {
|
app = Javalin.create(config -> {
|
||||||
config.useVirtualThreads = true;
|
config.addStaticFiles("/Web", Location.EXTERNAL);
|
||||||
config.staticFiles.add("/Web");
|
});
|
||||||
config.router.apiBuilder(()->{
|
app.get("/", ctx -> ctx.result("Hello World"));
|
||||||
// API for AAS Mini
|
app.get("/aasmini", ctx -> ctx.result("AAS Mini API"));
|
||||||
path("aasmini", ()->{
|
app.get("/protegegx", ctx -> ctx.result("ProtegeGX API"));
|
||||||
//TODO implement API for AAS Mini
|
app.post("/aasmini", ctx ->{
|
||||||
get(ctx -> ctx.result("AAS Mini API"));
|
try{
|
||||||
post(ctx -> {
|
WebRequest request = gson.fromJson(ctx.body(), WebRequest.class);
|
||||||
try{
|
WebResponse response = ProcessAAS(request);
|
||||||
WebRequest request = gson.fromJson(ctx.body(), WebRequest.class);
|
if (response!=null){
|
||||||
WebResponse response = ProcessAAS(request);
|
ctx.result(gson.toJson(response));
|
||||||
if (response!=null){
|
} else {
|
||||||
ctx.result(gson.toJson(response));
|
ctx.status(400);
|
||||||
} else {
|
ctx.result("No response from AAS Mini");
|
||||||
ctx.status(400);
|
}
|
||||||
ctx.result("No response from AAS Mini");
|
} catch(Exception e){
|
||||||
}
|
ctx.status(400);
|
||||||
} catch(Exception e){
|
ctx.result("Exception: "+e.getMessage());
|
||||||
ctx.status(400);
|
}
|
||||||
ctx.result("Exception: "+e.getMessage());
|
});
|
||||||
}
|
app.post("/protegegx", ctx ->{
|
||||||
});
|
try{
|
||||||
});
|
WebRequest request = gson.fromJson(ctx.body(), WebRequest.class);
|
||||||
// API for ProtegeGX
|
WebResponse response = ProcessProtegeGX(request);
|
||||||
path("protegegx", ()->{
|
if (response!=null){
|
||||||
//TODO implement API for ProtegeGX
|
ctx.result(gson.toJson(response));
|
||||||
get(ctx -> ctx.result("ProtegeGX API"));
|
} else {
|
||||||
post(ctx -> {
|
ctx.status(400);
|
||||||
try{
|
ctx.result("No response from ProtegeGX");
|
||||||
WebRequest request = gson.fromJson(ctx.body(), WebRequest.class);
|
}
|
||||||
WebResponse response = ProcessProtegeGX(request);
|
} catch(Exception e){
|
||||||
if (response!=null){
|
ctx.status(400);
|
||||||
ctx.result(gson.toJson(response));
|
ctx.result("Exception: "+e.getMessage());
|
||||||
} else {
|
}
|
||||||
ctx.status(400);
|
|
||||||
ctx.result("No response from ProtegeGX");
|
|
||||||
}
|
|
||||||
} catch(Exception e){
|
|
||||||
ctx.status(400);
|
|
||||||
ctx.result("Exception: "+e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user