diff --git a/avaje-jex/src/main/java/io/avaje/jex/FilterChain.java b/avaje-jex/src/main/java/io/avaje/jex/FilterChain.java deleted file mode 100644 index 2e636459..00000000 --- a/avaje-jex/src/main/java/io/avaje/jex/FilterChain.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.avaje.jex; - -import java.io.IOException; - -import com.sun.net.httpserver.HttpExchange; - -/** Filter chain that contains all subsequent filters that are configured, as well as the final route. */ -@FunctionalInterface -public interface FilterChain { - - /** - * Calls the next filter in the chain, or else the user's exchange handler, if this is the final - * filter in the chain. The {@link HttpFilter} may decide to terminate the chain, by not calling - * this method. In this case, the filter must send the response to the request, because the - * application's {@linkplain HttpExchange exchange} handler will not be invoked. - * - * @throws IOException if an I/O error occurs - */ - void proceed() throws IOException; -} diff --git a/avaje-jex/src/main/java/io/avaje/jex/HttpFilter.java b/avaje-jex/src/main/java/io/avaje/jex/HttpFilter.java index 982cff0a..5d5b56b4 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/HttpFilter.java +++ b/avaje-jex/src/main/java/io/avaje/jex/HttpFilter.java @@ -2,14 +2,16 @@ import java.io.IOException; +import com.sun.net.httpserver.HttpExchange; + /** * A filter used to pre- and post-process incoming requests. Pre-processing occurs before the * application's exchange handler is invoked, and post-processing occurs after the exchange handler * returns. Filters are organized in chains, and are associated with {@link Context} instances. * *

Each {@code HttpFilter} in the chain, invokes the next filter within its own {@link - * #filter(Context, FilterChain)} implementation. The final {@code HttpFilter} in the chain invokes the - * applications exchange handler. + * #filter(Context, FilterChain)} implementation. The final {@code HttpFilter} in the chain invokes + * the applications exchange handler. */ @FunctionalInterface public interface HttpFilter { @@ -36,4 +38,22 @@ public interface HttpFilter { * @param chain the {@code FilterChain} which allows the next filter to be invoked */ void filter(Context ctx, FilterChain chain) throws IOException; + + /** + * Filter chain that contains all subsequent filters that are configured, as well as the final + * route. + */ + @FunctionalInterface + public interface FilterChain { + + /** + * Calls the next filter in the chain, or else the user's exchange handler, if this is the final + * filter in the chain. The {@link HttpFilter} may decide to terminate the chain, by not calling + * this method. In this case, the filter must send the response to the request, because + * the application's {@linkplain HttpExchange exchange} handler will not be invoked. + * + * @throws IOException if an I/O error occurs + */ + void proceed() throws IOException; + } } diff --git a/avaje-jex/src/main/java/io/avaje/jex/ResourceLocation.java b/avaje-jex/src/main/java/io/avaje/jex/ResourceLocation.java deleted file mode 100644 index cd5da741..00000000 --- a/avaje-jex/src/main/java/io/avaje/jex/ResourceLocation.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.avaje.jex; - -public enum ResourceLocation { - CLASS_PATH, - FILE -} \ No newline at end of file diff --git a/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java b/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java index 14aa1e11..1f666375 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java +++ b/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java @@ -90,4 +90,9 @@ static StaticContentConfig create() { * @return the updated configuration */ StaticContentConfig location(ResourceLocation location); + + public enum ResourceLocation { + CLASS_PATH, + FILE + } } diff --git a/avaje-jex/src/main/java/io/avaje/jex/StaticResourceHandlerBuilder.java b/avaje-jex/src/main/java/io/avaje/jex/StaticResourceHandlerBuilder.java index f58ec14f..832ce2f3 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/StaticResourceHandlerBuilder.java +++ b/avaje-jex/src/main/java/io/avaje/jex/StaticResourceHandlerBuilder.java @@ -1,6 +1,6 @@ package io.avaje.jex; -import static io.avaje.jex.ResourceLocation.CLASS_PATH; +import static io.avaje.jex.StaticContentConfig.ResourceLocation.CLASS_PATH; import java.io.File; import java.net.URL; diff --git a/avaje-jex/src/test/java/io/avaje/jex/StaticFileTest.java b/avaje-jex/src/test/java/io/avaje/jex/StaticFileTest.java index 9af60c62..e470ad66 100644 --- a/avaje-jex/src/test/java/io/avaje/jex/StaticFileTest.java +++ b/avaje-jex/src/test/java/io/avaje/jex/StaticFileTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; +import io.avaje.jex.StaticContentConfig.ResourceLocation; import io.avaje.jex.jdk.TestPair; class StaticFileTest { diff --git a/avaje-jex/src/test/java/io/avaje/jex/compression/CompressionTest.java b/avaje-jex/src/test/java/io/avaje/jex/compression/CompressionTest.java index f53529a7..ac9ab042 100644 --- a/avaje-jex/src/test/java/io/avaje/jex/compression/CompressionTest.java +++ b/avaje-jex/src/test/java/io/avaje/jex/compression/CompressionTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; import io.avaje.jex.Jex; -import io.avaje.jex.ResourceLocation; +import io.avaje.jex.StaticContentConfig.ResourceLocation; import io.avaje.jex.core.Constants; import io.avaje.jex.jdk.TestPair;