This commit is contained in:
lukas-heiligenbrunner 2020-01-30 15:04:42 +01:00
parent 339ba9861b
commit e5d579e9d0
7 changed files with 29 additions and 2 deletions

1
.idea/misc.xml generated
View File

@ -6,6 +6,7 @@
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$USER_HOME$/Schreibtisch/testjavadoc" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="true" project-jdk-name="13" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />

View File

@ -22,6 +22,15 @@ public class Log {
private static final String ANSI_CYAN = "\u001B[36m";
private static final String ANSI_WHITE = "\u001B[37m";
// TODO: 30.01.20 update to enum
// public enum Kind{
// CRITICAL_ERROR,
// ERROR,
// WARNING,
// INFO,
// MESSAGE,
// DEBUG
// }
public static final int CRITICAL_ERROR = 6;
public static final int ERROR = 5;
public static final int WARNING = 4;

View File

@ -37,6 +37,8 @@ public class JDBC {
usernamec = username;
passwordc = password;
dbnamec = dbname;
ipc = ip;
portc = port;
JDBC = new JDBC(username, password, dbname, ip, port);
}
@ -61,7 +63,7 @@ public class JDBC {
}
public static void logintodb(String username, String password, String dbname, String ip, int port) throws IOException {
private static void logintodb(String username, String password, String dbname, String ip, int port) throws IOException {
Database db = new MySQLConnector(
username,
password,

View File

@ -8,6 +8,10 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
/**
* basic GET request handler
* reply function has to be implemented!
*/
public abstract class GetRequest implements HttpHandler {
@Override
public void handle(HttpExchange httpExchange) throws IOException {

View File

@ -9,8 +9,11 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
/**
* basic POST request handler
* reply function has to be implemented!
*/
public abstract class PostRequest implements HttpHandler {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
if (httpExchange.getRequestMethod().equals("POST")) {

View File

@ -5,6 +5,9 @@ import com.wasteinformationserver.website.basicrequest.PostRequest;
import java.util.HashMap;
/**
* request handler for checking the login state of a user
*/
public class CheckLoginState extends PostRequest {
@Override
public String request(HashMap<String, String> params) {

View File

@ -10,6 +10,11 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
/**
* request handler of new login request of user
* - checks the truth of username and password
* - replies right error messages or the success login
*/
public class LoginRequest extends PostRequest {
@Override
public String request(HashMap<String, String> params) {