diff --git a/src/main/java/testserver/MainController.java b/src/main/java/testserver/MainController.java new file mode 100644 index 00000000..4f94d5bd --- /dev/null +++ b/src/main/java/testserver/MainController.java @@ -0,0 +1,38 @@ +package testserver; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import cokr.xit.foundation.data.DataObject; +import cokr.xit.foundation.web.AbstractController; +import cokr.xit.foundation.web.RequestHandlerReader; + +@Controller +public class MainController extends AbstractController { + @Autowired + private RequestMappingHandlerMapping requestHandlers; + + @GetMapping(name="로그인", value="/login.do") + public String loginPage() { + return "login"; + } + + @GetMapping(name="홈", value={"/", "/index.do"}) + public ModelAndView mainPage() { + return new ModelAndView("index"); + } + + @RequestMapping(name="기능 URL 선택", value="/urls.do") + public ModelAndView getURLs(boolean multiple) { + List urls = new RequestHandlerReader().read(requestHandlers); + return new ModelAndView("select-url") + .addObject("multiple", multiple) + .addObject("urls", toJson(urls)); + } +} \ No newline at end of file