Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit e2785bd

Browse files
authored
Impl #22 (#25)
Co-authored-by: Katsute <[email protected]>
1 parent 8464593 commit e2785bd

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.kttdevelopment</groupId>
88
<artifactId>simplehttpserver</artifactId>
9-
<version>03.01.01</version>
9+
<version>03.02.00</version>
1010
<packaging>jar</packaging>
1111

1212
<url>https://github.com/Ktt-Development/simplehttpserver</url>

src/main/java/com/kttdevelopment/simplehttpserver/handler/PredicateHandler.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.kttdevelopment.simplehttpserver.handler;
22

3+
import com.sun.net.httpserver.HttpExchange;
34
import com.sun.net.httpserver.HttpHandler;
45
import com.kttdevelopment.simplehttpserver.SimpleHttpExchange;
56
import com.kttdevelopment.simplehttpserver.SimpleHttpHandler;
@@ -18,10 +19,10 @@
1819
* @version 02.00.00
1920
* @author Ktt Development
2021
*/
21-
public class PredicateHandler extends SimpleHttpHandler {
22+
public class PredicateHandler implements HttpHandler {
2223

2324
private final HttpHandler T, F;
24-
private final Predicate<SimpleHttpExchange> predicate;
25+
private final Predicate<HttpExchange> predicate;
2526

2627
/**
2728
* Creates a predicate handler.
@@ -37,15 +38,15 @@ public class PredicateHandler extends SimpleHttpHandler {
3738
* @since 01.00.00
3839
* @author Ktt Development
3940
*/
40-
public PredicateHandler(final HttpHandler trueHandler, final HttpHandler falseHandler, final Predicate<SimpleHttpExchange> predicate){
41+
public PredicateHandler(final HttpHandler trueHandler, final HttpHandler falseHandler, final Predicate<HttpExchange> predicate){
4142
T = trueHandler;
4243
F = falseHandler;
4344
this.predicate = predicate;
4445
}
4546

4647
@Override
47-
public final void handle(final SimpleHttpExchange exchange) throws IOException{
48-
(predicate.test(exchange) ? T : F).handle(exchange.getHttpExchange());
48+
public final void handle(final HttpExchange exchange) throws IOException{
49+
(predicate.test(exchange) ? T : F).handle(exchange);
4950
}
5051

5152
//

src/main/java/com/kttdevelopment/simplehttpserver/handler/RootHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public RootHandler(final HttpHandler rootHandler, final HttpHandler elseHandler)
2929
super(
3030
rootHandler,
3131
elseHandler,
32-
simpleHttpExchange -> simpleHttpExchange.getURI().getPath().equals("/")
32+
httpExchange -> httpExchange.getRequestURI().getPath().equals("/")
3333
);
3434
}
3535

0 commit comments

Comments
 (0)