From 641dccd06b85be717e13aefbc97b4a15b726dd7b Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Sat, 26 Nov 2016 23:14:11 -0500 Subject: [PATCH] Rename handlers to filters to better express functionality --- src/main/java/net/frozenorb/apiv3/APIv3.java | 16 ++++++++-------- .../AuthenticationFilter.java} | 4 ++-- .../AuthorizationFilter.java} | 4 ++-- .../MetricsFilter.java} | 4 ++-- .../WebsiteUserSessionFilter.java} | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) rename src/main/java/net/frozenorb/apiv3/{handler/ActorAttributeHandler.java => filter/AuthenticationFilter.java} (93%) rename src/main/java/net/frozenorb/apiv3/{handler/AuthorizationHandler.java => filter/AuthorizationFilter.java} (81%) rename src/main/java/net/frozenorb/apiv3/{handler/MetricsHandler.java => filter/MetricsFilter.java} (88%) rename src/main/java/net/frozenorb/apiv3/{handler/WebsiteUserSessionHandler.java => filter/WebsiteUserSessionFilter.java} (96%) diff --git a/src/main/java/net/frozenorb/apiv3/APIv3.java b/src/main/java/net/frozenorb/apiv3/APIv3.java index 46649d2..42eda73 100644 --- a/src/main/java/net/frozenorb/apiv3/APIv3.java +++ b/src/main/java/net/frozenorb/apiv3/APIv3.java @@ -37,10 +37,10 @@ import io.vertx.ext.web.handler.LoggerHandler; import io.vertx.ext.web.handler.TimeoutHandler; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.frozenorb.apiv3.handler.ActorAttributeHandler; -import net.frozenorb.apiv3.handler.AuthorizationHandler; -import net.frozenorb.apiv3.handler.MetricsHandler; -import net.frozenorb.apiv3.handler.WebsiteUserSessionHandler; +import net.frozenorb.apiv3.filter.AuthenticationFilter; +import net.frozenorb.apiv3.filter.AuthorizationFilter; +import net.frozenorb.apiv3.filter.MetricsFilter; +import net.frozenorb.apiv3.filter.WebsiteUserSessionFilter; import net.frozenorb.apiv3.model.*; import net.frozenorb.apiv3.route.*; import net.frozenorb.apiv3.route.accessTokens.DELETEAccessTokensId; @@ -301,10 +301,10 @@ public final class APIv3 extends AbstractVerticle { http.route().handler(LoggerHandler.create(LoggerFormat.TINY)); http.route().handler(TimeoutHandler.create(TimeUnit.SECONDS.toMillis(5))); http.route().method(HttpMethod.PUT).method(HttpMethod.POST).method(HttpMethod.DELETE).handler(BodyHandler.create()); - http.route().handler(new ActorAttributeHandler()); - http.route().handler(new MetricsHandler()); - http.route().handler(new WebsiteUserSessionHandler()); - http.route().handler(new AuthorizationHandler()); + http.route().handler(new AuthenticationFilter()); + http.route().handler(new MetricsFilter()); + http.route().handler(new WebsiteUserSessionFilter()); + http.route().handler(new AuthorizationFilter()); http.exceptionHandler(Throwable::printStackTrace); // TODO: The commented out routes diff --git a/src/main/java/net/frozenorb/apiv3/handler/ActorAttributeHandler.java b/src/main/java/net/frozenorb/apiv3/filter/AuthenticationFilter.java similarity index 93% rename from src/main/java/net/frozenorb/apiv3/handler/ActorAttributeHandler.java rename to src/main/java/net/frozenorb/apiv3/filter/AuthenticationFilter.java index d8a3abf..6595a4d 100644 --- a/src/main/java/net/frozenorb/apiv3/handler/ActorAttributeHandler.java +++ b/src/main/java/net/frozenorb/apiv3/filter/AuthenticationFilter.java @@ -1,4 +1,4 @@ -package net.frozenorb.apiv3.handler; +package net.frozenorb.apiv3.filter; import com.google.common.collect.ImmutableMap; import io.vertx.core.Handler; @@ -8,7 +8,7 @@ import net.frozenorb.apiv3.actor.SimpleActor; import net.frozenorb.apiv3.model.AccessToken; import net.frozenorb.apiv3.util.ErrorUtils; -public final class ActorAttributeHandler implements Handler { +public final class AuthenticationFilter implements Handler { @Override public void handle(RoutingContext ctx) { diff --git a/src/main/java/net/frozenorb/apiv3/handler/AuthorizationHandler.java b/src/main/java/net/frozenorb/apiv3/filter/AuthorizationFilter.java similarity index 81% rename from src/main/java/net/frozenorb/apiv3/handler/AuthorizationHandler.java rename to src/main/java/net/frozenorb/apiv3/filter/AuthorizationFilter.java index 65f1880..9422ddf 100644 --- a/src/main/java/net/frozenorb/apiv3/handler/AuthorizationHandler.java +++ b/src/main/java/net/frozenorb/apiv3/filter/AuthorizationFilter.java @@ -1,4 +1,4 @@ -package net.frozenorb.apiv3.handler; +package net.frozenorb.apiv3.filter; import com.google.common.collect.ImmutableMap; import io.vertx.core.Handler; @@ -6,7 +6,7 @@ import io.vertx.ext.web.RoutingContext; import net.frozenorb.apiv3.actor.Actor; import net.frozenorb.apiv3.util.ErrorUtils; -public final class AuthorizationHandler implements Handler { +public final class AuthorizationFilter implements Handler { @Override public void handle(RoutingContext ctx) { diff --git a/src/main/java/net/frozenorb/apiv3/handler/MetricsHandler.java b/src/main/java/net/frozenorb/apiv3/filter/MetricsFilter.java similarity index 88% rename from src/main/java/net/frozenorb/apiv3/handler/MetricsHandler.java rename to src/main/java/net/frozenorb/apiv3/filter/MetricsFilter.java index 1cbb2b6..b171c21 100644 --- a/src/main/java/net/frozenorb/apiv3/handler/MetricsHandler.java +++ b/src/main/java/net/frozenorb/apiv3/filter/MetricsFilter.java @@ -1,4 +1,4 @@ -package net.frozenorb.apiv3.handler; +package net.frozenorb.apiv3.filter; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; @@ -6,7 +6,7 @@ import io.vertx.redis.RedisClient; import io.vertx.redis.RedisOptions; import net.frozenorb.apiv3.APIv3; -public final class MetricsHandler implements Handler { +public final class MetricsFilter implements Handler { private static final RedisClient redisClient = RedisClient.create(APIv3.getVertxInstance(), new RedisOptions() diff --git a/src/main/java/net/frozenorb/apiv3/handler/WebsiteUserSessionHandler.java b/src/main/java/net/frozenorb/apiv3/filter/WebsiteUserSessionFilter.java similarity index 96% rename from src/main/java/net/frozenorb/apiv3/handler/WebsiteUserSessionHandler.java rename to src/main/java/net/frozenorb/apiv3/filter/WebsiteUserSessionFilter.java index a377010..517e53b 100644 --- a/src/main/java/net/frozenorb/apiv3/handler/WebsiteUserSessionHandler.java +++ b/src/main/java/net/frozenorb/apiv3/filter/WebsiteUserSessionFilter.java @@ -1,4 +1,4 @@ -package net.frozenorb.apiv3.handler; +package net.frozenorb.apiv3.filter; import com.google.common.collect.ImmutableMap; import io.vertx.core.Handler; @@ -12,7 +12,7 @@ import net.frozenorb.apiv3.util.IpUtils; import net.frozenorb.apiv3.util.UserSessionUtils; @Slf4j -public final class WebsiteUserSessionHandler implements Handler { +public final class WebsiteUserSessionFilter implements Handler { @Override public void handle(RoutingContext ctx) {