diff --git a/objectmorph-app/pom.xml b/objectmorph-app/pom.xml
index 58773c3..ceb3ebe 100644
--- a/objectmorph-app/pom.xml
+++ b/objectmorph-app/pom.xml
@@ -8,7 +8,7 @@
objectmorph-app
17
- 17
+ 17
objectmorph-app
Demo project for Spring Boot
@@ -17,7 +17,6 @@
org.springframework.boot
spring-boot-starter-web
-
org.springframework.boot
spring-boot-starter-test
@@ -54,7 +53,24 @@
docker.io/ennahdi/${project.artifactId}:${project.version}
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.7
+
+
+ @
+
+ false
+
+
+
+
+ src/main/resources
+ true
+
+
diff --git a/objectmorph-app/src/main/java/com/github/mohamedennahdi/objectmorph/app/controller/ObjectmorphController.java b/objectmorph-app/src/main/java/com/github/mohamedennahdi/objectmorph/app/controller/ObjectmorphController.java
index 3a68812..52ed06a 100644
--- a/objectmorph-app/src/main/java/com/github/mohamedennahdi/objectmorph/app/controller/ObjectmorphController.java
+++ b/objectmorph-app/src/main/java/com/github/mohamedennahdi/objectmorph/app/controller/ObjectmorphController.java
@@ -1,8 +1,10 @@
package com.github.mohamedennahdi.objectmorph.app.controller;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -18,6 +20,9 @@ public class ObjectmorphController {
ObjectmorphService objectmorphService;
+ @Value("${spring.application.version}")
+ private String applicationVersion;
+
public ObjectmorphController(ObjectmorphService objectmorphService) {
this.objectmorphService = objectmorphService;
}
@@ -35,4 +40,15 @@ public ObjectmorphController(ObjectmorphService objectmorphService) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
+
+ @CrossOrigin(origins = "*")
+ @GetMapping( value = "/version" )
+ public ResponseEntity version() {
+ try {
+ return new ResponseEntity<>(applicationVersion, HttpStatus.OK);
+ } catch (Exception e) {
+ log.error("Error in ObjectmorphController", e);
+ return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
}
diff --git a/objectmorph-app/src/main/resources/application.yml b/objectmorph-app/src/main/resources/application.yml
index 080013d..e8be6ef 100644
--- a/objectmorph-app/src/main/resources/application.yml
+++ b/objectmorph-app/src/main/resources/application.yml
@@ -1,8 +1,14 @@
spring:
application:
- name: "objectmorph-app"
+ name: "@project.name@"
+ version: "@project.version@"
+ description: "@project.description@"
+ groupId: "@project.groupId@"
+ artifactId: "@project.artifactId@"
logging:
level:
root: INFO
pattern:
console: "[%level] %d{yyyy-MM-dd HH:mm:ss} - %logger{1.} - %msg%n"
+server:
+ max-http-request-header-size: 65000
\ No newline at end of file
diff --git a/objectmorph-app/src/main/resources/public/client.html b/objectmorph-app/src/main/resources/public/client.html
index 1a53332..75fe788 100644
--- a/objectmorph-app/src/main/resources/public/client.html
+++ b/objectmorph-app/src/main/resources/public/client.html
@@ -1,68 +1,72 @@
-
-
-Objectmorph-Sample-Client
-
-
- Objectmorph Sample Client
-
- This page executes client side code.
-
-
- Executable locally.
-
-
-
-
-
-
+
+
+ Home
+ Objectmorph Sample Client
+ This page executes client side code.
+
+ Executable locally.
+
+
+
+
+
+
+
+ function UserAction(file) {
+ var xhttp = new XMLHttpRequest();
+ xhttp.onreadystatechange = function() {
+ if (this.readyState == 4) {
+ if (this.status == 200) {
+ console.log(this.responseText);
+ const winUrl = URL.createObjectURL(new Blob([this.responseText], { type: "text/html" }));
+ const win = window.open(winUrl, "win", `width=512,height=512`);
+ } else {
+ alert('Error: ' + this.status + " " + this.responseText);
+ }
+ };
+ }
+ var url = location.protocol + '//' + location.host + "/html";
+ xhttp.open("POST", url, true);
+ var data = new FormData();
+ data.append('sourceCode', file);
+ xhttp.send(data);
+ }
+