Merge remote-tracking branch 'origin/master'
# Conflicts: # .idea/.gitignore # src/com/wasteinformationserver/main.java
This commit is contained in:
commit
8810b1dcae
41
.idea/$PRODUCT_WORKSPACE_FILE$
Normal file
41
.idea/$PRODUCT_WORKSPACE_FILE$
Normal 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
2
.idea/.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
# Default ignored files
|
# Default ignored files
|
||||||
/workspace.xml
|
/workspace.xml
|
||||||
|
# Default ignored files
|
||||||
|
/workspace.xml
|
11
.idea/artifacts/WasteinformationServer.xml
Normal file
11
.idea/artifacts/WasteinformationServer.xml
Normal 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>
|
@ -4,6 +4,7 @@
|
|||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
BIN
lib/mysql-connector-java-5.1.44-bin.jar
Executable file → Normal file
BIN
lib/mysql-connector-java-5.1.44-bin.jar
Executable file → Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 536 KiB After Width: | Height: | Size: 536 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
@ -1,8 +1,6 @@
|
|||||||
package com.wasteinformationserver.db;
|
package com.wasteinformationserver.db;
|
||||||
|
|
||||||
import com.wasteinformationserver.basicutils.Log;
|
import com.wasteinformationserver.basicutils.Log;
|
||||||
import com.wasteinformationserver.db.Database;
|
|
||||||
import com.wasteinformationserver.db.MySQLConnector;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.wasteinformationserver;
|
package com.wasteinformationserver;
|
||||||
|
|
||||||
|
import com.wasteinformationserver.basicutils.Log;
|
||||||
import com.wasteinformationserver.mqtt.*;
|
import com.wasteinformationserver.mqtt.*;
|
||||||
|
import com.wasteinformationserver.website.Webserver;
|
||||||
|
|
||||||
public class main {
|
public class main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -10,7 +12,7 @@ public class main {
|
|||||||
D.printList();
|
D.printList();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
Log.warning("Shutting down ...");
|
Log.warning("Shutting down ...");
|
||||||
@ -24,10 +26,11 @@ public class main {
|
|||||||
Thread mythread = new Thread(() -> new Webserver().startserver());
|
Thread mythread = new Thread(() -> new Webserver().startserver());
|
||||||
mythread.start();
|
mythread.start();
|
||||||
|
|
||||||
Log.message("thread started");*/
|
Log.message("thread started");
|
||||||
|
|
||||||
mqtt m = new mqtt();
|
// mqtt m = new mqtt();
|
||||||
m.notifymessage();
|
// m.notifymessage();
|
||||||
|
// m.getDatabasedata();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.wasteinformationserver.website;
|
package com.wasteinformationserver.website;
|
||||||
|
|
||||||
import com.wasteinformationserver.basicutils.Log;
|
import com.wasteinformationserver.basicutils.Log;
|
||||||
import com.wasteinformationserver.db.PostRequest;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.wasteinformationserver.website;
|
package com.wasteinformationserver.website;
|
||||||
|
|
||||||
import com.wasteinformationserver.db.PostRequest;
|
|
||||||
import com.wasteinformationserver.db.jdcb;
|
import com.wasteinformationserver.db.jdcb;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
@ -5,11 +5,10 @@ import com.sun.net.httpserver.HttpExchange;
|
|||||||
import com.sun.net.httpserver.HttpHandler;
|
import com.sun.net.httpserver.HttpHandler;
|
||||||
import com.wasteinformationserver.basicutils.Log;
|
import com.wasteinformationserver.basicutils.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.awt.*;
|
||||||
import java.io.FileInputStream;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
public class MainPage implements HttpHandler {
|
public class MainPage implements HttpHandler {
|
||||||
@Override
|
@Override
|
||||||
@ -25,9 +24,13 @@ public class MainPage implements HttpHandler {
|
|||||||
}
|
}
|
||||||
Log.message("looking for: " + root + path);
|
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.
|
// Object does not exist or is not a file: reject with 404 error.
|
||||||
String response = "404 (Not Found)\n";
|
String response = "404 (Not Found)\n";
|
||||||
t.sendResponseHeaders(404, response.length());
|
t.sendResponseHeaders(404, response.length());
|
||||||
@ -45,7 +48,7 @@ public class MainPage implements HttpHandler {
|
|||||||
t.sendResponseHeaders(200, 0);
|
t.sendResponseHeaders(200, 0);
|
||||||
|
|
||||||
OutputStream os = t.getResponseBody();
|
OutputStream os = t.getResponseBody();
|
||||||
FileInputStream fs = new FileInputStream(file);
|
// FileInputStream fs = new FileInputStream(file);
|
||||||
final byte[] buffer = new byte[0x10000];
|
final byte[] buffer = new byte[0x10000];
|
||||||
int count;
|
int count;
|
||||||
while ((count = fs.read(buffer)) >= 0) {
|
while ((count = fs.read(buffer)) >= 0) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.wasteinformationserver.db;
|
package com.wasteinformationserver.website;
|
||||||
|
|
||||||
import com.sun.net.httpserver.Headers;
|
import com.sun.net.httpserver.Headers;
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
@ -1,6 +1,5 @@
|
|||||||
package com.wasteinformationserver.website;
|
package com.wasteinformationserver.website;
|
||||||
|
|
||||||
import com.wasteinformationserver.db.PostRequest;
|
|
||||||
import com.wasteinformationserver.db.jdcb;
|
import com.wasteinformationserver.db.jdcb;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -4,7 +4,6 @@ import com.sun.net.httpserver.HttpServer;
|
|||||||
import com.wasteinformationserver.basicutils.Log;
|
import com.wasteinformationserver.basicutils.Log;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +27,4 @@ public class Webserver {
|
|||||||
Log.info("Server available at http://127.0.0.1:8000 now");
|
Log.info("Server available at http://127.0.0.1:8000 now");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user