-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
495 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
4.spring-MVC2/exception/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
server.error.whitelabel.enabled=false | ||
server.error.include-exception=true | ||
server.error.include-message=always | ||
#server.error.include-message=always | ||
#server.error.include-stacktrace=always | ||
#server.error.include-binding-errors=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
4.spring-MVC2/login/src/main/java/hello/login/web/filter/LogFilter1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package hello.login.web.filter; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import javax.servlet.*; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
|
||
@Slf4j | ||
public class LogFilter1 implements Filter { | ||
|
||
@Override | ||
public void init(FilterConfig filterConfig) throws ServletException { | ||
log.info("log filter init-1"); | ||
} | ||
|
||
@Override | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | ||
log.info("log filter doFilter1"); | ||
//ServletRequest는 HttpServletRequest의 부모인데 ServletRequest의 기능은 너무 적기 때문에 HttpServletRequest로 캐스팅 해줘야한다. | ||
HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
String requestURI = httpRequest.getRequestURI(); | ||
|
||
|
||
String uuid = UUID.randomUUID().toString(); | ||
|
||
try{ | ||
log.info("REQUEST-1[{}][{}]", uuid, requestURI); | ||
//chain은 filter과정이 더 남아있으면 더 남은 과정으로 이동하고 아닐경우 servlet과정을 진행한다. 현재 스프링을 사용하므로 정확히는 DispatchServlet으로 넘어가서 mapping과정을 진행한다. | ||
chain.doFilter(request, response); | ||
}catch (Exception e){ | ||
throw e; | ||
} | ||
finally { | ||
log.info("RESPONSE1 [{}][{}]", uuid, requestURI); | ||
} | ||
log.info("Survie Response-1! [{}][{}]", uuid, requestURI); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
System.out.println("log filter destroy-1"); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
4.spring-MVC2/login/src/main/java/hello/login/web/filter/LogFilter2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package hello.login.web.filter; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import javax.servlet.*; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
|
||
@Slf4j | ||
public class LogFilter2 implements Filter { | ||
|
||
@Override | ||
public void init(FilterConfig filterConfig) throws ServletException { | ||
log.info("log filter init-2"); | ||
} | ||
|
||
@Override | ||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | ||
log.info("log filter doFilter2"); | ||
//ServletRequest는 HttpServletRequest의 부모인데 ServletRequest의 기능은 너무 적기 때문에 HttpServletRequest로 캐스팅 해줘야한다. | ||
HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
String requestURI = httpRequest.getRequestURI(); | ||
|
||
|
||
String uuid = UUID.randomUUID().toString(); | ||
|
||
try{ | ||
log.info("REQUEST-2[{}][{}]", uuid, requestURI); | ||
//chain은 filter과정이 더 남아있으면 더 남은 과정으로 이동하고 아닐경우 servlet과정을 진행한다. 현재 스프링을 사용하므로 정확히는 DispatchServlet으로 넘어가서 mapping과정을 진행한다. | ||
chain.doFilter(request, response); | ||
}catch (Exception e){ | ||
throw e; | ||
} | ||
finally { | ||
log.info("RESPONSE2 [{}][{}]", uuid, requestURI); | ||
} | ||
log.info("Survie Response-2! [{}][{}]", uuid, requestURI); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
System.out.println("log filter destroy-2"); | ||
} | ||
} |
Oops, something went wrong.