* created pwa
* fixed jdbc warning * new gradle run task * new gradle jar-build task
This commit is contained in:
@ -8,7 +8,7 @@ public class MySQLConnector extends Database {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.cj.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ public class main {
|
||||
Log.message("initial login to db");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
JDCB.init("users", "kOpaIJUjkgb9ur6S", "wasteinformation", "192.168.65.15", 3306);
|
||||
JDCB.init("ingproject", "Kb9Dxklumt76ieq6", "ingproject", "db.power4future.at", 3306);
|
||||
//JDCB.init("users", "kOpaIJUjkgb9ur6S", "wasteinformation", "192.168.65.15", 3306);
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
Log.error("no connection to db");
|
||||
|
@ -23,12 +23,13 @@ public class Webserver {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
server.createContext("/", new MainPage());
|
||||
|
||||
server.createContext("/senddata/loginget", new LoginRequest());
|
||||
server.createContext("/senddata/registerpost",new RegisterRequest());
|
||||
server.createContext("/senddata/checkloginstate",new CheckLoginState());
|
||||
server.createContext("/senddata/wastedata",new DataRequest());
|
||||
server.createContext("/senddata/registerpost", new RegisterRequest());
|
||||
server.createContext("/senddata/checkloginstate", new CheckLoginState());
|
||||
server.createContext("/senddata/wastedata", new DataRequest());
|
||||
server.createContext("/senddata/admindata", new AdminRequests());
|
||||
server.createContext("/senddata/newdate", new NewDateRequest());
|
||||
|
||||
@ -36,5 +37,63 @@ public class Webserver {
|
||||
server.start();
|
||||
Log.info("Server available at http://127.0.0.1:8000 now");
|
||||
|
||||
/*
|
||||
|
||||
try {
|
||||
server = HttpsServer.create(new InetSocketAddress(8000), 0);
|
||||
|
||||
// initialise the HTTPS server
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
|
||||
// initialise the keystore
|
||||
char[] password = "password".toCharArray();
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
FileInputStream fis = new FileInputStream("testkey.jks");
|
||||
ks.load(fis, password);
|
||||
|
||||
// setup the key manager factory
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, password);
|
||||
|
||||
// setup the trust manager factory
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
tmf.init(ks);
|
||||
|
||||
// setup the HTTPS context and parameters
|
||||
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
|
||||
public void configure(HttpsParameters params) {
|
||||
try {
|
||||
// initialise the SSL context
|
||||
SSLContext context = getSSLContext();
|
||||
SSLEngine engine = context.createSSLEngine();
|
||||
params.setNeedClientAuth(false);
|
||||
params.setCipherSuites(engine.getEnabledCipherSuites());
|
||||
params.setProtocols(engine.getEnabledProtocols());
|
||||
|
||||
// Set the SSL parameters
|
||||
SSLParameters sslParameters = context.getSupportedSSLParameters();
|
||||
params.setSSLParameters(sslParameters);
|
||||
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Failed to create HTTPS port");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CertificateException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnrecoverableKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyStoreException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class LoginState {
|
||||
private String email;
|
||||
private int permission;
|
||||
|
||||
boolean loggedin = false;
|
||||
boolean loggedin = true;
|
||||
|
||||
public void logIn(){
|
||||
loggedin=true;
|
||||
|
Reference in New Issue
Block a user