Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/.gitignore
#	src/com/wasteinformationserver/main.java
This commit is contained in:
Gregor_Dutzler 2019-10-11 15:06:00 +02:00
commit 8810b1dcae
35 changed files with 73 additions and 20 deletions

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="masterDetails">
<states>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

2
.idea/.gitignore vendored
View File

@ -1,2 +1,4 @@
# Default ignored files
/workspace.xml
# Default ignored files
/workspace.xml

View File

@ -0,0 +1,11 @@
<component name="ArtifactManager">
<artifact type="jar" build-on-make="true" name="WasteinformationServer">
<output-path>$PROJECT_DIR$/out/artifacts/WasteinformationServer</output-path>
<root id="archive" name="WasteinformationServer.jar">
<element id="module-output" name="WasteInformationServer" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/mysql-connector-java-5.1.44-bin.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/org.eclipse.paho.client.mqttv3-1.2.1.jar" path-in-jar="/" />
<element id="dir-copy" path="$PROJECT_DIR$/resources" />
</root>
</artifact>
</component>

View File

@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

BIN
lib/mysql-connector-java-5.1.44-bin.jar Executable file → Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 536 KiB

After

Width:  |  Height:  |  Size: 536 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -1,8 +1,6 @@
package com.wasteinformationserver.db;
import com.wasteinformationserver.basicutils.Log;
import com.wasteinformationserver.db.Database;
import com.wasteinformationserver.db.MySQLConnector;
import java.sql.Connection;
import java.sql.PreparedStatement;

View File

@ -1,6 +1,8 @@
package com.wasteinformationserver;
import com.wasteinformationserver.basicutils.Log;
import com.wasteinformationserver.mqtt.*;
import com.wasteinformationserver.website.Webserver;
public class main {
public static void main(String[] args) {
@ -10,7 +12,7 @@ public class main {
D.printList();
*/
/* Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
Thread.sleep(200);
Log.warning("Shutting down ...");
@ -24,10 +26,11 @@ public class main {
Thread mythread = new Thread(() -> new Webserver().startserver());
mythread.start();
Log.message("thread started");*/
Log.message("thread started");
mqtt m = new mqtt();
m.notifymessage();
// mqtt m = new mqtt();
// m.notifymessage();
// m.getDatabasedata();
}
}

View File

@ -1,7 +1,6 @@
package com.wasteinformationserver.website;
import com.wasteinformationserver.basicutils.Log;
import com.wasteinformationserver.db.PostRequest;
import java.util.HashMap;

View File

@ -1,6 +1,5 @@
package com.wasteinformationserver.website;
import com.wasteinformationserver.db.PostRequest;
import com.wasteinformationserver.db.jdcb;
import java.sql.ResultSet;

View File

@ -5,11 +5,10 @@ import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.wasteinformationserver.basicutils.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.awt.*;
import java.io.*;
import java.net.URI;
import java.net.URL;
public class MainPage implements HttpHandler {
@Override
@ -25,9 +24,13 @@ public class MainPage implements HttpHandler {
}
Log.message("looking for: " + root + path);
File file = new File(root + path).getCanonicalFile();
if (!file.isFile()) {
// File file = new File(getClass().getResource("/wwwroot"+path).getFile()).getCanonicalFile();
InputStream fs = getClass().getResourceAsStream("/wwwroot"+path);
// File file = new File(root + path).getCanonicalFile();
if (fs.available() < 1) {
// Object does not exist or is not a file: reject with 404 error.
String response = "404 (Not Found)\n";
t.sendResponseHeaders(404, response.length());
@ -45,7 +48,7 @@ public class MainPage implements HttpHandler {
t.sendResponseHeaders(200, 0);
OutputStream os = t.getResponseBody();
FileInputStream fs = new FileInputStream(file);
// FileInputStream fs = new FileInputStream(file);
final byte[] buffer = new byte[0x10000];
int count;
while ((count = fs.read(buffer)) >= 0) {

View File

@ -1,4 +1,4 @@
package com.wasteinformationserver.db;
package com.wasteinformationserver.website;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;

View File

@ -1,6 +1,5 @@
package com.wasteinformationserver.website;
import com.wasteinformationserver.db.PostRequest;
import com.wasteinformationserver.db.jdcb;
import java.util.HashMap;

View File

@ -4,7 +4,6 @@ import com.sun.net.httpserver.HttpServer;
import com.wasteinformationserver.basicutils.Log;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -28,6 +27,4 @@ public class Webserver {
Log.info("Server available at http://127.0.0.1:8000 now");
}
}