Skip to content

Commit 870620b

Browse files
committed
Rename method
1 parent 53cd79c commit 870620b

35 files changed

+88
-97
lines changed

src/main/java/httpserver/responder/DeleteResponder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public DeleteResponder(PathExaminer pathExaminer, FileOperator fileOperator) {
2323

2424
@Override
2525
public Response respond(AppConfig appConfig, Request request) throws IOException {
26-
if (allowed(request.getPathString())) {
26+
if (handles(request.getPathString())) {
2727
Path fullPath = pathExaminer.getFullPath(appConfig.getRoot(), request.getPathString());
2828
if (pathExaminer.pathExists(fullPath)) {
2929
fileOperator.deleteFileAtPath(fullPath);
@@ -36,7 +36,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
3636
}
3737
}
3838

39-
public boolean allowed(String pathString) {
39+
public boolean handles(String pathString) {
4040
return pathString.equals("/form");
4141
}
4242
}

src/main/java/httpserver/responder/FormGetResponder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
3232
}
3333

3434
@Override
35-
public boolean allowed(String pathString) {
35+
public boolean handles(String pathString) {
3636
return pathString.equals("/form");
3737
}
3838
}

src/main/java/httpserver/responder/GeneralResponder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public Response respond(AppConfig appConfig, Request request) {
2727
}
2828

2929
@Override
30-
public boolean allowed(String pathString) {
30+
public boolean handles(String pathString) {
3131
return true;
3232
}
3333
}

src/main/java/httpserver/responder/GetResponder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private Response responseForFile(Path path, Request request) {
8484
return response;
8585
}
8686

87-
public boolean allowed(String s) {
87+
public boolean handles(String s) {
8888
return true;
8989
}
9090
}

src/main/java/httpserver/responder/InvalidMethodResponder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public Response respond(AppConfig appConfig, Request request) {
1212
}
1313

1414
@Override
15-
public boolean allowed(String pathString) {
15+
public boolean handles(String pathString) {
1616
return true;
1717
}
1818
}

src/main/java/httpserver/responder/OptionsResponder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
2424
StringJoiner joiner = new StringJoiner(",");
2525
for (Method method: methods) {
2626
Responder responder = responderSupplier.responderForMethodString(method.toString());
27-
if (responder.allowed(request.getPathString())) {
27+
if (responder.handles(request.getPathString())) {
2828
joiner.add(method.toString());
2929
}
3030
}
@@ -34,7 +34,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
3434
}
3535

3636
@Override
37-
public boolean allowed(String pathString) {
37+
public boolean handles(String pathString) {
3838
return true;
3939
}
4040
}

src/main/java/httpserver/responder/PatchResponder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public PatchResponder(PathExaminer pathExaminer,
2424

2525
@Override
2626
public Response respond(AppConfig appConfig, Request request) throws IOException {
27-
if (allowed(request.getPathString())) {
27+
if (handles(request.getPathString())) {
2828
Path fullPath = pathExaminer.getFullPath(appConfig.getRoot(), request.getPathString());
2929
if (pathExaminer.pathExists(fullPath)) {
3030
if (noIfMatchHeader(request)) {
@@ -53,7 +53,7 @@ private boolean matchingHash(Path fullPath, Request request) {
5353
return hasher.matches(fileContents, ifMatchHash);
5454
}
5555

56-
public boolean allowed(String pathString) {
56+
public boolean handles(String pathString) {
5757
return pathString.equals("/patch-content.txt");
5858
}
5959
}

src/main/java/httpserver/responder/PostResponder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public PostResponder(PathExaminer pathExaminer, FileOperator fileOperator) {
2121

2222
@Override
2323
public Response respond(AppConfig appConfig, Request request) throws IOException {
24-
if (allowed(request.getPathString())) {
24+
if (handles(request.getPathString())) {
2525
Path fullPath = pathExaminer.getFullPath(appConfig.getRoot(), request.getPathString());
2626
if (pathExaminer.pathExists(fullPath)) {
2727
fileOperator.replaceContents(fullPath, request.getBody().getBytes());
@@ -35,7 +35,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
3535
return new MethodNotAllowedResponse();
3636
}
3737

38-
public boolean allowed(String pathString) {
38+
public boolean handles(String pathString) {
3939
return pathString.equals("/form") || pathString.equals("/method_options");
4040
}
4141
}

src/main/java/httpserver/responder/PutResponder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public PutResponder(PathExaminer pathExaminer, FileOperator fileOperator) {
2323

2424
@Override
2525
public Response respond(AppConfig appConfig, Request request) throws IOException {
26-
if (allowed(request.getPathString())) {
26+
if (handles(request.getPathString())) {
2727
Path fullPath = pathExaminer.getFullPath(appConfig.getRoot(), request.getPathString());
2828
if (pathExaminer.pathExists(fullPath)) {
2929
fileOperator.replaceContents(fullPath, request.getBody().getBytes());
@@ -35,7 +35,7 @@ public Response respond(AppConfig appConfig, Request request) throws IOException
3535
return new MethodNotAllowedResponse();
3636
}
3737

38-
public boolean allowed(String pathString) {
38+
public boolean handles(String pathString) {
3939
return pathString.equals("/form") || pathString.equals("/method_options");
4040
}
4141
}

src/main/java/httpserver/responder/Responder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
public interface Responder {
1010
Response respond(AppConfig appConfig, Request request) throws IOException;
1111

12-
boolean allowed(String pathString);
12+
boolean handles(String pathString);
1313
}

0 commit comments

Comments
 (0)