Skip to content

Commit

Permalink
Skeleton web UI plugin.
Browse files Browse the repository at this point in the history
Now with working dependencies and webserver.
  • Loading branch information
csmith committed Jan 31, 2016
1 parent b68e97e commit 456b540
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui_web2/build.gradle
@@ -1,3 +1,3 @@
dependencies {
bundle group: 'com.sparkcore', name: 'spark-core', version: '4.2'
bundle group: 'com.sparkjava', name: 'spark-core', version: '2.3'
}
4 changes: 2 additions & 2 deletions ui_web2/plugin.config
Expand Up @@ -11,7 +11,7 @@ keysections:

metadata:
author=Chris <chris@dmdirc.com>
mainclass=com.dmdirc.addons.ui_web2.WebController
mainclass=com.dmdirc.addons.ui_web2.WebUiPlugin
description=Web-based DMDirc user interface
name=ui_web2
nicename=Web UI
Expand All @@ -23,7 +23,7 @@ version:
friendly=0.0

provides:
web ui
#web ui

defaults:

Expand Down
@@ -0,0 +1 @@
org.eclipse.jetty.http.Http1FieldPreEncoder
26 changes: 26 additions & 0 deletions ui_web2/res/jetty-logging.properties
@@ -0,0 +1,26 @@
#
# Copyright (c) 2006-2016 DMDirc Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

# Configure Jetty for StdErrLog Logging
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StrErrLog
# Overall Logging Level is INFO
org.eclipse.jetty.LEVEL=DEBUG
47 changes: 47 additions & 0 deletions ui_web2/src/com/dmdirc/addons/ui_web2/WebUiPlugin.java
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2006-2015 DMDirc Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.dmdirc.addons.ui_web2;

import com.dmdirc.plugins.implementations.BasePlugin;

import static spark.Spark.get;
import static spark.Spark.stop;

/**
* Web UI plugin.
*/
public class WebUiPlugin extends BasePlugin {

@Override
public void onLoad() {
super.onLoad();
get("/test", (request, response) -> "HELLO");
}

@Override
public void onUnload() {
super.onUnload();
stop();
}

}

0 comments on commit 456b540

Please sign in to comment.