Browse Source

Merge pull request #435 from csmith/web2

Skeleton web UI plugin.
pull/436/head
Greg Holmes 8 years ago
parent
commit
ce66d9d735

+ 1
- 1
ui_web2/build.gradle View File

@@ -1,3 +1,3 @@
1 1
 dependencies {
2
-  bundle group: 'com.sparkcore', name: 'spark-core', version: '4.2'
2
+  bundle group: 'com.sparkjava', name: 'spark-core', version: '2.3'
3 3
 }

+ 2
- 2
ui_web2/plugin.config View File

@@ -11,7 +11,7 @@ keysections:
11 11
 
12 12
 metadata:
13 13
   author=Chris <chris@dmdirc.com>
14
-  mainclass=com.dmdirc.addons.ui_web2.WebController
14
+  mainclass=com.dmdirc.addons.ui_web2.WebUiPlugin
15 15
   description=Web-based DMDirc user interface
16 16
   name=ui_web2
17 17
   nicename=Web UI
@@ -23,7 +23,7 @@ version:
23 23
   friendly=0.0
24 24
 
25 25
 provides:
26
-  web ui
26
+  #web ui
27 27
 
28 28
 defaults:
29 29
 

+ 1
- 0
ui_web2/res/META-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder View File

@@ -0,0 +1 @@
1
+org.eclipse.jetty.http.Http1FieldPreEncoder

+ 26
- 0
ui_web2/res/jetty-logging.properties View File

@@ -0,0 +1,26 @@
1
+#
2
+# Copyright (c) 2006-2016 DMDirc Developers
3
+#
4
+# Permission is hereby granted, free of charge, to any person obtaining a copy
5
+# of this software and associated documentation files (the "Software"), to deal
6
+# in the Software without restriction, including without limitation the rights
7
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+# copies of the Software, and to permit persons to whom the Software is
9
+# furnished to do so, subject to the following conditions:
10
+#
11
+# The above copyright notice and this permission notice shall be included in
12
+# all copies or substantial portions of the Software.
13
+#
14
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+# SOFTWARE.
21
+#
22
+
23
+# Configure Jetty for StdErrLog Logging
24
+org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StrErrLog
25
+# Overall Logging Level is INFO
26
+org.eclipse.jetty.LEVEL=DEBUG

+ 47
- 0
ui_web2/src/com/dmdirc/addons/ui_web2/WebUiPlugin.java View File

@@ -0,0 +1,47 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.ui_web2;
24
+
25
+import com.dmdirc.plugins.implementations.BasePlugin;
26
+
27
+import static spark.Spark.get;
28
+import static spark.Spark.stop;
29
+
30
+/**
31
+ * Web UI plugin.
32
+ */
33
+public class WebUiPlugin extends BasePlugin {
34
+
35
+    @Override
36
+    public void onLoad() {
37
+        super.onLoad();
38
+        get("/test", (request, response) -> "HELLO");
39
+    }
40
+
41
+    @Override
42
+    public void onUnload() {
43
+        super.onUnload();
44
+        stop();
45
+    }
46
+
47
+}

Loading…
Cancel
Save