Merge remote-tracking branch 'origin/master'
# Conflicts: # .idea/.gitignore # src/com/wasteinformationserver/main.java
This commit is contained in:
commit
8810b1dcae
35 files changed
+73
-20
No files matched your search
Generated
+41
@@ -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>
|
||||
Generated
+2
@@ -1,2 +1,4 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
||||
# Default ignored files
|
||||
/workspace.xml
|
||||
+11
@@ -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>
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -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" />
|
||||
|
||||
Executable → Regular
BIN
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.PostRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.wasteinformationserver.db.PostRequest;
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wasteinformationserver.db;
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.wasteinformationserver.db.PostRequest;
|
||||
import com.wasteinformationserver.db.jdcb;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user