전체 글
-
[17] Spring Web MVC : HtmlUnitSpring/Spring boot 2020. 6. 26. 08:55
[HtmlUnit] HtmlUnit은 HTML를 unit test 하기 위한 tool입니다. Spring boot는 HtmlUnit에 대한 자동설정을 지원합니다. HtmlUnit을 사용하기 위해서는 먼저 관련된 두 가지 의존성을 추가해야 합니다. pom.xml을 열어 dependencies tag 안에 다음의 내용을 추가해주세요. org.seleniumhq.selenium htmlunit-driver test net.sourceforge.htmlunit htmlunit test HtmlUnit을 통해 진행하는 test에 대해 적용할 수 있는 여러가지 요소들이 있습니다. 자세한 내용은 HtmlUnit에 대한 reference를 참고해 주세요. (reference 보기) form을 가져와서 submit하는 ..
-
[16] Spring Web MVC : Template EngineSpring/Spring boot 2020. 6. 24. 21:53
[Template Engine] Template engine은 주로 view를 만드는 데 사용합니다. spring boot가 자동 설정을 지원하는 template engine은 다음과 같습니다. FreeMarker Groovy Thymeleaf Mustache JSP를 spring boot의 template engine으로 권장하지 않는 이유는 다음과 같습니다. JAR패키징 할 때는 동작하지 않고, WAR패키징 해야 함. JSP 의존성 추가 시 문제 발생할 가능성이 있음 Undertow는 JSP를 지원하지 않음. https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-limitations [Thymele..
-
[15] Spring Web MVC : Index page and FaviconSpring/Spring boot 2020. 6. 24. 21:09
[Index page] index page는 application root에 접근했을 때 보여주는 page로 index page를 찾는 순서는 다음과 같습니다. index.html (static resource)를 찾아보고 있으면 제공 index.{template file 확장자} (dynamic resource)를 찾아보고 있으면 제공 두 종료의 resource에 해당하는 index page가 없는 경우 spring boot error page 제공 /resources/static/index.html file을 생성하고 그 내용을 다음과 같이 작성해봅니다. Welcom to spring boot world application을 기동하고 http://localhost:8080/ 로 접근하면 white ..
-
[14] Spring Web MVC : Web JARSpring/Spring boot 2020. 6. 23. 19:41
[Web JAR란] Web JAR는 jQuery, ReactJS, vue.js, Angular 등과 같이 client-side에서 동작하는 web library들을 JAR file로 packaging한 것입니다. 의존성을 추가하기만 하면 JAR 안에 있는 css나 javascript 등을 사용할 수 있습니다. [Web JAR의 사용] Web JAR를 사용하기 위해서는 우선 사용하고자 하는 Web JAR에 대한 의존성을 추가해야 합니다. Maven repository(https://mvnrepository.com/)에서 많은 Web JAR를 제공하고 필요한 JAR를 검색하여 사용합니다. 만약 jQuery에 대한 Web JAR 의존성을 추가하고자 한다면, Maven repsitory에서 jquery를 검색합..
-
[13] Spring Web MVC : static resource 지원Spring/Spring boot 2020. 6. 22. 17:23
[Static resource의 기본 경로와 사용법] static resource는 request에 대해 response할 때 사용되는 이미 존재하는 resource를 말합니다. classpath:/static classpath:/public classpath:/resources/ classpath:/META-INF/resources 위 네가지 path 있는 resource들은 "/**" request에 mapping 되어 제공됩니다. 예를 들어 "/hello.html"이라는 request가 들어왔을 때 /static/hello.html 이라는 resource가 존재하면 그것을 사용하여 response 해줍니다. static resource request 시 어떻게 response 되는지 확인해보기 위해..
-
[12] Spring Web MVC : ViewResolverSpring/Spring boot 2020. 6. 21. 09:27
[ContentNegotiatingViewResolver] ContentNegotiatingViewResolver는 file명 또는 Accept header를 기반으로 view를 처리하는 ViewResolver의 구현체입니다. ContentNegotiatingViewResolver는 view 자체를 resolving하지 않는 대신 다른 view resolvers에게 resolving 하도록 위임합니다. 보통 application context에서 view resolving을 위임받을 view resolver들을 자동으로 선택 하지만 viewResolvers property를 사용하여 사용하고자 하는 view resolver를 명시적으로 설정할 수도 있습니다. 명시적으로 설정한 view resolver가 ..
-
Spring MVCSpring/Spring MVC 2020. 6. 21. 08:59
[MVC model on Spring Framework] Model application의 상태(data)를 담는 객체입니다. 일반적으로 POJO입니다. Java Beans View Model의 data를 randering하여 사용자에게 보여주는 역할을 합니다. Controller View와 Model의 Connection을 담당합니다. Client의 request를 받아 response에 필요한 data를 Model에 담고 그 것을 View에 전달하는 역할을 합니다. 즉, Model object와 View name을 반환합니다. Controller —> Service —> Dao DB","output":"—> DB","etype":"space"}" data-grammar-id="grammar2" dat..
-
HTTP Request와 ResponseWeb관련 2020. 6. 17. 12:58
(HTTP request와 response에 대해 참고할만한 글) [HTTP Request] HTTP Request는 통신을 위해 client에서 server로 전송되는 binary data packet입니다. HTTP Reqeust는 다음과 같은 요소를 포함하고 있습니다. 1. Request Line Request Line은 GET, PUT 등과 같은 Method Token 뒤에 Request URI와 사용중인 HTTP Protocol을 지정합니다. 2. Header(header는 request 안에 없는 경우도 있습니다.) Request Body 이전까지가 Request Header입니다. 3.Request Body (request body는 request 안에 없는 경우도 있습니다.) Reqeust..