From 9c015aae55d352924b9653ca36c86d546eb1fd32 Mon Sep 17 00:00:00 2001 From: kliakos Date: Wed, 2 Mar 2016 20:59:06 +0200 Subject: [PATCH 1/7] Initial commit --- .gitignore | 3 ++ pom.xml | 55 +++++++++++++++++++++++++++++++++ src/main/java/HelloWorld.java | 14 +++++++++ src/main/webapp/WEB-INF/web.xml | 19 ++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/HelloWorld.java create mode 100644 src/main/webapp/WEB-INF/web.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3bfaa70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/* +**/target/* +*.iml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..cd1a9f1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + sparkjava-hello-world + sparkjava-hello-world + 1.0 + war + + + + com.sparkjava + spark-core + 2.3 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + true + true + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.3.1 + + + enforce-java + + enforce + + + + + [1.8,) + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/HelloWorld.java b/src/main/java/HelloWorld.java new file mode 100644 index 0000000..2f1fbd8 --- /dev/null +++ b/src/main/java/HelloWorld.java @@ -0,0 +1,14 @@ +import spark.servlet.SparkApplication; + +import static spark.Spark.get; + +public class HelloWorld implements SparkApplication { + public static void main(String[] args) { + new HelloWorld().init(); + } + + @Override + public void init() { + get("/hello", (req, res) -> "Hello World"); + } +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..580d807 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,19 @@ + + + + SparkFilter + spark.servlet.SparkFilter + + applicationClass + HelloWorld + + + + + SparkFilter + /* + + \ No newline at end of file From 87b12bc760b74e035506969a3a79c92264438309 Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Wed, 2 Mar 2016 21:10:08 +0200 Subject: [PATCH 2/7] Create README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..069c1c1 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# sparkjava-war-example +Build war with maven and sparkjava framework + +Steps: + +1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi) +2. Clone the repository to your local machine +3. Run mvn package +4. Copy the generated `sparkjava-hello-world-1.0.war` to the Tomcat `webapps` folder +5. Tomcat will automatically deploy the war +6. Open [http://localhost:8080/sparkjava-hello-world-1.0/hello](http://localhost:8080/sparkjava-hello-world-1.0/hello) in your browser From acc24586c5d060bb36a83302ee09982d2c942b39 Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Wed, 2 Mar 2016 21:18:22 +0200 Subject: [PATCH 3/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 069c1c1..0aa0178 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,6 @@ Steps: 2. Clone the repository to your local machine 3. Run mvn package 4. Copy the generated `sparkjava-hello-world-1.0.war` to the Tomcat `webapps` folder +5. Start Tomcat bu running `bin\startup.bat` (or `bin\startaup.sh` for Linux) 5. Tomcat will automatically deploy the war 6. Open [http://localhost:8080/sparkjava-hello-world-1.0/hello](http://localhost:8080/sparkjava-hello-world-1.0/hello) in your browser From a99d53dbd38edb91c5c4e3af192c7a7c7eac4319 Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Wed, 2 Mar 2016 21:18:34 +0200 Subject: [PATCH 4/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0aa0178..b843246 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,6 @@ Steps: 2. Clone the repository to your local machine 3. Run mvn package 4. Copy the generated `sparkjava-hello-world-1.0.war` to the Tomcat `webapps` folder -5. Start Tomcat bu running `bin\startup.bat` (or `bin\startaup.sh` for Linux) +5. Start Tomcat by running `bin\startup.bat` (or `bin\startaup.sh` for Linux) 5. Tomcat will automatically deploy the war 6. Open [http://localhost:8080/sparkjava-hello-world-1.0/hello](http://localhost:8080/sparkjava-hello-world-1.0/hello) in your browser From 805dfa67eaf7e59253c65e7addca8d4cc4f05b95 Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Mon, 5 Nov 2018 08:54:29 +0200 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b843246..8d7640e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Build war with maven and sparkjava framework Steps: 1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi) -2. Clone the repository to your local machine +2. Clone this repository to your local machine 3. Run mvn package 4. Copy the generated `sparkjava-hello-world-1.0.war` to the Tomcat `webapps` folder 5. Start Tomcat by running `bin\startup.bat` (or `bin\startaup.sh` for Linux) From 8afafcebd360150895518f6df0687b3ceccfbdef Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Mon, 5 Nov 2018 09:02:27 +0200 Subject: [PATCH 6/7] Update sparkjava to 2.7.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cd1a9f1..5fd512c 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ com.sparkjava spark-core - 2.3 + 2.7.2 From 99484298060ecc6d7967293a8d08ff8e3630d80f Mon Sep 17 00:00:00 2001 From: Konstantinos Liakos Date: Tue, 29 Jan 2019 12:03:57 +0200 Subject: [PATCH 7/7] Add slf4j-simple for logging --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 5fd512c..f55768d 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,11 @@ spark-core 2.7.2 + + org.slf4j + slf4j-simple + 1.7.25 +