Skip to content

Commit

Permalink
Delete HttpResponseStatusCodes.java and statusCode field (#199)
Browse files Browse the repository at this point in the history
* change the setter methods to void type

* Convert statusCode to run methode and make fileRequestHandler final

* Delete HttpResponseStatusCodes.java and statusCode field

* Add HTTP_RESPONSE_STATUS_CODES to ResponseCode.java

* Restoration Setter methode in Configuration.java
  • Loading branch information
Kouroshkt authored Feb 13, 2024
1 parent 10b5f31 commit 292ece9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/main/java/org/fungover/storm/client/ClientHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.fungover.storm.filehandler.re.FileInfo;
import org.fungover.storm.filehandler.re.FileNotFoundException;
import org.fungover.storm.filehandler.re.FileRequestHandler;
import org.fungover.storm.filehandler.re.ResponseCode;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -16,8 +17,7 @@
public class ClientHandler implements Runnable {
private static final Logger LOGGER = LogManager.getLogger("CLIENT_HANDLER");
private final Socket clientSocket;
private HttpResponseStatusCodes statusCode;
private FileRequestHandler fileRequestHandler;
private final FileRequestHandler fileRequestHandler;

public ClientHandler(Socket socket, FileRequestHandler fileRequestHandler) {
this.clientSocket = socket;
Expand All @@ -43,9 +43,8 @@ public void run() {
out.close();
clientSocket.close();
} catch (IOException e) {
statusCode = new HttpResponseStatusCodes();
if (e.getMessage().contains("500"))
LOGGER.error(statusCode.getError500());
LOGGER.error(ResponseCode.HTTP_RESPONSE_STATUS_CODES);
else
LOGGER.error(e.getMessage());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ public enum ResponseCode {
FORBIDDEN("403 Forbidden"),
TEAPOT("418 I´m a teapot"),
INTERNAL_SERVER_ERROR("500 Internal Server Error"),
HTTP_RESPONSE_STATUS_CODES("500 Internal Server Error\r\n"),
NOT_IMPLEMENTED("501 Not Implemented");


private final String code;

ResponseCode(String code) {
Expand Down

0 comments on commit 292ece9

Please sign in to comment.