From e08fade548e1030d340f7349cce71b523503ce91 Mon Sep 17 00:00:00 2001 From: jjongwa Date: Mon, 25 Sep 2023 15:47:12 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/techcourse/DispatcherServletInitializer.java | 4 ++-- .../org/springframework/web/servlet/ModelAndView.java | 1 + .../web/servlet/mvc/DispatcherServlet.java | 10 +++++----- .../AnnotationHandlerAdapter.java | 3 ++- .../mvc/{tobe => handlerAdapter}/HandlerAdapter.java | 2 +- .../mvc/{tobe => handlerAdapter}/HandlerAdapters.java | 2 +- .../AnnotationHandlerMapping.java | 2 +- .../mvc/{tobe => handlerMapping}/HandlerExecution.java | 2 +- .../mvc/{tobe => handlerMapping}/HandlerKey.java | 2 +- .../mvc/{tobe => handlerMapping}/HandlerMapping.java | 2 +- .../mvc/{tobe => handlerMapping}/HandlerMappings.java | 2 +- .../org/springframework/web/servlet/view/JsonView.java | 1 - .../org/springframework/web/servlet/view/JspView.java | 1 - .../springframework/web/servlet/{ => view}/View.java | 2 +- .../servlet/mvc/tobe/AnnotationHandlerAdapterTest.java | 3 +++ .../servlet/mvc/tobe/AnnotationHandlerMappingTest.java | 2 ++ .../web/servlet/mvc/tobe/HandlerAdaptersTest.java | 4 ++++ 17 files changed, 27 insertions(+), 18 deletions(-) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerAdapter}/AnnotationHandlerAdapter.java (81%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerAdapter}/HandlerAdapter.java (85%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerAdapter}/HandlerAdapters.java (91%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerMapping}/AnnotationHandlerMapping.java (97%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerMapping}/HandlerExecution.java (91%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerMapping}/HandlerKey.java (93%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerMapping}/HandlerMapping.java (70%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/{tobe => handlerMapping}/HandlerMappings.java (91%) rename mvc/src/main/java/webmvc/org/springframework/web/servlet/{ => view}/View.java (83%) diff --git a/app/src/main/java/com/techcourse/DispatcherServletInitializer.java b/app/src/main/java/com/techcourse/DispatcherServletInitializer.java index 2053d97d65..9c20d67207 100644 --- a/app/src/main/java/com/techcourse/DispatcherServletInitializer.java +++ b/app/src/main/java/com/techcourse/DispatcherServletInitializer.java @@ -5,8 +5,8 @@ import org.slf4j.LoggerFactory; import web.org.springframework.web.WebApplicationInitializer; import webmvc.org.springframework.web.servlet.mvc.DispatcherServlet; -import webmvc.org.springframework.web.servlet.mvc.tobe.AnnotationHandlerAdapter; -import webmvc.org.springframework.web.servlet.mvc.tobe.AnnotationHandlerMapping; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.AnnotationHandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.AnnotationHandlerMapping; /** * Base class for {@link WebApplicationInitializer} implementations that register a {@link DispatcherServlet} in the diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/ModelAndView.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/ModelAndView.java index ff8e24553f..ae41543586 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/ModelAndView.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/ModelAndView.java @@ -3,6 +3,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import webmvc.org.springframework.web.servlet.view.View; public class ModelAndView { diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/DispatcherServlet.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/DispatcherServlet.java index b4c3d34a59..d0a8a98997 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/DispatcherServlet.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/DispatcherServlet.java @@ -8,11 +8,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webmvc.org.springframework.web.servlet.ModelAndView; -import webmvc.org.springframework.web.servlet.View; -import webmvc.org.springframework.web.servlet.mvc.tobe.HandlerAdapter; -import webmvc.org.springframework.web.servlet.mvc.tobe.HandlerAdapters; -import webmvc.org.springframework.web.servlet.mvc.tobe.HandlerMapping; -import webmvc.org.springframework.web.servlet.mvc.tobe.HandlerMappings; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerMapping; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerMappings; +import webmvc.org.springframework.web.servlet.view.View; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.HandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.HandlerAdapters; public class DispatcherServlet extends HttpServlet { diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapter.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/AnnotationHandlerAdapter.java similarity index 81% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapter.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/AnnotationHandlerAdapter.java index 974286c4a4..ee3ea5e410 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapter.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/AnnotationHandlerAdapter.java @@ -1,8 +1,9 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerAdapter; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import webmvc.org.springframework.web.servlet.ModelAndView; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerExecution; public class AnnotationHandlerAdapter implements HandlerAdapter { diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapter.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapter.java similarity index 85% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapter.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapter.java index 72443cbf0e..b1f8c24370 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapter.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapter.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerAdapter; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapters.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapters.java similarity index 91% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapters.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapters.java index fcf9687061..afc0898dc3 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdapters.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerAdapter/HandlerAdapters.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerAdapter; import jakarta.servlet.ServletException; import java.util.ArrayList; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMapping.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/AnnotationHandlerMapping.java similarity index 97% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMapping.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/AnnotationHandlerMapping.java index e879554243..9a6ec6df4e 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMapping.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/AnnotationHandlerMapping.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerMapping; import context.org.springframework.stereotype.Controller; import jakarta.servlet.http.HttpServletRequest; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerExecution.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerExecution.java similarity index 91% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerExecution.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerExecution.java index 6b292d0772..b7da22f1ac 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerExecution.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerExecution.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerMapping; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerKey.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerKey.java similarity index 93% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerKey.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerKey.java index 30d3c780ff..a9015b97a9 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerKey.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerKey.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerMapping; import web.org.springframework.web.bind.annotation.RequestMethod; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMapping.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMapping.java similarity index 70% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMapping.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMapping.java index 2fd9df144a..273c003878 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMapping.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMapping.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerMapping; import jakarta.servlet.http.HttpServletRequest; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMappings.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMappings.java similarity index 91% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMappings.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMappings.java index 32bc09324c..99b400e989 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerMappings.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/handlerMapping/HandlerMappings.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet.mvc.tobe; +package webmvc.org.springframework.web.servlet.mvc.handlerMapping; import jakarta.servlet.http.HttpServletRequest; import java.util.ArrayList; diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JsonView.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JsonView.java index c244d36176..668245c237 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JsonView.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JsonView.java @@ -6,7 +6,6 @@ import java.io.PrintWriter; import java.util.Map; import web.org.springframework.http.MediaType; -import webmvc.org.springframework.web.servlet.View; public class JsonView implements View { diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JspView.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JspView.java index 494804921c..523017c1ad 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JspView.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/JspView.java @@ -6,7 +6,6 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import webmvc.org.springframework.web.servlet.View; public class JspView implements View { diff --git a/mvc/src/main/java/webmvc/org/springframework/web/servlet/View.java b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/View.java similarity index 83% rename from mvc/src/main/java/webmvc/org/springframework/web/servlet/View.java rename to mvc/src/main/java/webmvc/org/springframework/web/servlet/view/View.java index e3dcec2408..335f34eba3 100644 --- a/mvc/src/main/java/webmvc/org/springframework/web/servlet/View.java +++ b/mvc/src/main/java/webmvc/org/springframework/web/servlet/view/View.java @@ -1,4 +1,4 @@ -package webmvc.org.springframework.web.servlet; +package webmvc.org.springframework.web.servlet.view; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; diff --git a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapterTest.java b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapterTest.java index 1451dacd48..aa9bff660c 100644 --- a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapterTest.java +++ b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerAdapterTest.java @@ -9,6 +9,9 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import webmvc.org.springframework.web.servlet.ModelAndView; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.AnnotationHandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.HandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerExecution; import webmvc.org.springframework.web.servlet.view.JsonView; class AnnotationHandlerAdapterTest { diff --git a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMappingTest.java b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMappingTest.java index dcec215a3f..18d87f8aff 100644 --- a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMappingTest.java +++ b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationHandlerMappingTest.java @@ -4,6 +4,8 @@ import jakarta.servlet.http.HttpServletResponse; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.AnnotationHandlerMapping; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerExecution; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdaptersTest.java b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdaptersTest.java index 913536d2e8..a579c4fb84 100644 --- a/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdaptersTest.java +++ b/mvc/src/test/java/webmvc/org/springframework/web/servlet/mvc/tobe/HandlerAdaptersTest.java @@ -8,6 +8,10 @@ import jakarta.servlet.ServletException; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.AnnotationHandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.HandlerAdapter; +import webmvc.org.springframework.web.servlet.mvc.handlerAdapter.HandlerAdapters; +import webmvc.org.springframework.web.servlet.mvc.handlerMapping.HandlerExecution; class HandlerAdaptersTest { private final HandlerAdapters handlerAdaptors = new HandlerAdapters();