Skip to content
Snippets Groups Projects
Commit e12b1356 authored by mateis00's avatar mateis00
Browse files

Server kann nun mit API requests antworten

parent a396dcb0
Branches
No related tags found
1 merge request!3Ich checke nicht, warum der In und Output nicht funktioniert.
......@@ -101,6 +101,20 @@ public class Server{
zumClient.write("DATE "+new SimpleDateFormat("dd.MM.yyyy").format(new Date())+"\n");
zumClient.flush();
}
else if(eingabe.substring(0,8).equalsIgnoreCase("HOLIDAYS"))
{
String year = eingabe.substring(10,14);
String output1= getHolidays(year);
zumClient.write(output1 + "\n");
zumClient.flush();
}
else if(eingabe.equalsIgnoreCase("LATEST NEWS"))
{
String output2 = getImportantNews();
zumClient.write(output2 + "\n");
zumClient.flush();
}
else if(eingabe.equalsIgnoreCase("history")) {
String ausg = "Gesamter Verlauf: ";
for(int i=0; i<verlauf.size()-1; i++) { // Die gesamte Arraylist wird ausgegeben
......@@ -153,7 +167,7 @@ public class Server{
zumClient.flush();
}
} catch (IOException | NullPointerException e) {
} catch (Exception e) {
System.err.println("Fehler beim schreiben zum Client");
try {
zumClient.write("ERROR 500 INTERNAL SERVER ERROR\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment