-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
e7b5fe1
commit f668600
Showing
14 changed files
with
156 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,27 +4,27 @@ | |
* @author KIM HWANG MAN( [email protected] ) | ||
* @since 2020.11.25 | ||
*/ | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import common.exception.ExceptionResolver; | ||
import common.filter.XSSFilter; | ||
import common.interceptor.PermissionCheckInterceptor; | ||
import common.views.FileView; | ||
import common.views.XlsxStreamingView; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.FilterType; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.accept.ContentNegotiationManager; | ||
import org.springframework.web.accept.ContentNegotiationManagerFactoryBean; | ||
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy; | ||
import org.springframework.web.filter.ShallowEtagHeaderFilter; | ||
import org.springframework.web.multipart.commons.CommonsMultipartResolver; | ||
import org.springframework.web.multipart.MultipartResolver; | ||
import org.springframework.web.multipart.support.StandardServletMultipartResolver; | ||
import org.springframework.web.servlet.LocaleResolver; | ||
import org.springframework.web.servlet.View; | ||
import org.springframework.web.servlet.ViewResolver; | ||
|
@@ -36,22 +36,21 @@ | |
import org.springframework.web.servlet.view.BeanNameViewResolver; | ||
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; | ||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView; | ||
import org.thymeleaf.spring5.SpringTemplateEngine; | ||
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; | ||
import org.thymeleaf.spring5.view.ThymeleafViewResolver; | ||
import org.thymeleaf.spring6.SpringTemplateEngine; | ||
import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver; | ||
import org.thymeleaf.spring6.view.ThymeleafViewResolver; | ||
import org.thymeleaf.templatemode.TemplateMode; | ||
|
||
import common.exception.ExceptionResolver; | ||
import common.filter.XSSFilter; | ||
import common.interceptor.PermissionCheckInterceptor; | ||
import common.views.FileView; | ||
import common.views.XlsxStreamingView; | ||
import java.util.*; | ||
|
||
@Configuration | ||
@ComponentScan(basePackages = { "common" }, includeFilters = { | ||
@ComponentScan(basePackages = { "common", "kr.goldmandata.www" }, includeFilters = { | ||
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class) }) | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
|
||
@Autowired | ||
Environment env; | ||
|
||
/** | ||
* Servlet Filters | ||
*/ | ||
|
@@ -117,7 +116,10 @@ public SpringResourceTemplateResolver springResourceTemplateResolver() { | |
srtr.setPrefix("classpath:templates/"); | ||
srtr.setSuffix(".html"); | ||
srtr.setTemplateMode(TemplateMode.HTML); | ||
srtr.setCacheable(false); | ||
|
||
if (env.getActiveProfiles().length == 0 || !"prod".equals(env.getActiveProfiles()[0])) { | ||
srtr.setCacheable(false); | ||
} | ||
return srtr; | ||
} | ||
@Bean | ||
|
@@ -135,6 +137,18 @@ public ThymeleafViewResolver thymeleafViewResolver() { | |
return tvr; | ||
} | ||
|
||
/* | ||
@Override | ||
public void configureContentNegotiation (ContentNegotiationConfigurer configurer) { | ||
configurer.favorPathExtension(true). | ||
ignoreAcceptHeader(true). | ||
useJaf(false). | ||
defaultContentType(MediaType.APPLICATION_JSON). | ||
mediaType("json", MediaType.APPLICATION_JSON). | ||
mediaType("view", MediaType.TEXT_HTML). | ||
mediaType("xlsx", MediaType.valueOf("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); | ||
} | ||
*/ | ||
@Override | ||
public void configureContentNegotiation (ContentNegotiationConfigurer configurer) { | ||
Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>(); | ||
|
@@ -174,11 +188,11 @@ public ExceptionResolver exceptionResolver() { | |
} | ||
|
||
@Bean | ||
public CommonsMultipartResolver multipartResolver() { | ||
CommonsMultipartResolver cmr = new CommonsMultipartResolver(); | ||
cmr.setMaxUploadSize(52428800); // 50MB | ||
cmr.setMaxInMemorySize(52428800); // 50MB | ||
return cmr; | ||
public MultipartResolver multipartResolver() { | ||
// CommonsServletMultipartResolver cmr = new CommonsServletMultipartResolver(); | ||
// cmr.setMaxUploadSize(52428800); // 50MB | ||
// cmr.setMaxInMemorySize(52428800); // 50MB | ||
return new StandardServletMultipartResolver(); | ||
} | ||
|
||
@Bean | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
|
||
import java.io.IOException; | ||
|
||
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.Filter; | ||
import jakarta.servlet.FilterChain; | ||
import jakarta.servlet.FilterConfig; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.ServletRequest; | ||
import jakarta.servlet.ServletResponse; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author KIM HWANG MAN( [email protected] ) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
package common.interceptor; | ||
|
||
import java.lang.invoke.MethodHandles; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.util.AntPathMatcher; | ||
import org.springframework.web.servlet.HandlerInterceptor; | ||
import org.springframework.web.servlet.ModelAndView; | ||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import java.lang.invoke.MethodHandles; | ||
|
||
/** | ||
* @author KIM HWANG MAN( [email protected] ) | ||
* @since 2018.12.05 | ||
*/ | ||
public class PermissionCheckInterceptor extends HandlerInterceptorAdapter { | ||
public class PermissionCheckInterceptor implements HandlerInterceptor { | ||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
|
||
public String[] excludeURLs; | ||
|
@@ -48,11 +47,9 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons | |
|
||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) | ||
throws Exception { | ||
super.postHandle(request, response, handler, modelAndView); | ||
} | ||
|
||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { | ||
super.afterCompletion(request, response, handler, ex); | ||
} | ||
|
||
} |
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
Oops, something went wrong.