diff --git a/ax-boot-admin/pom.xml b/ax-boot-admin/pom.xml index f917fd37..dfbcfdfb 100644 --- a/ax-boot-admin/pom.xml +++ b/ax-boot-admin/pom.xml @@ -12,7 +12,7 @@ com.chequer.axboot ax-boot-framework - 2.1.0 + 2.1.1 diff --git a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootSecurityConfig.java b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootSecurityConfig.java index 890c812b..849190ac 100644 --- a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootSecurityConfig.java +++ b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootSecurityConfig.java @@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; -import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -19,7 +18,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.Authentication; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; diff --git a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootWebMvcConfigurerAdapter.java b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootWebMvcConfigurerAdapter.java index 5759098e..33c42f7e 100644 --- a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootWebMvcConfigurerAdapter.java +++ b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/AXBootWebMvcConfigurerAdapter.java @@ -5,7 +5,6 @@ import com.chequer.axboot.core.filters.MultiReadableHttpServletRequestFilter; import com.chequer.axboot.core.json.ContentTypeSwitchableMappingJackson2JsonView; import com.chequer.axboot.core.parameter.RequestParamsArgumentResolver; -import com.chequer.axboot.core.utils.PhaseUtils; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonEncoding; import com.fasterxml.jackson.core.JsonParser; diff --git a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/security/AXBootTokenAuthenticationService.java b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/security/AXBootTokenAuthenticationService.java index cbc9dbc1..f35f8b8d 100644 --- a/ax-boot-admin/src/main/java/com/chequer/axboot/admin/security/AXBootTokenAuthenticationService.java +++ b/ax-boot-admin/src/main/java/com/chequer/axboot/admin/security/AXBootTokenAuthenticationService.java @@ -14,7 +14,6 @@ import com.chequer.axboot.core.vo.ScriptSessionVO; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.tomcat.jni.Global; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/ax-boot-admin/src/main/resources/axboot-common.properties b/ax-boot-admin/src/main/resources/axboot-common.properties index 27fe07d7..edd186c3 100755 --- a/ax-boot-admin/src/main/resources/axboot-common.properties +++ b/ax-boot-admin/src/main/resources/axboot-common.properties @@ -1,9 +1,6 @@ # IDENTITY spring.application.name=AXBoot -# AutoConfigure Exclude -#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration - # Multipart spring.http.multipart.enabled=true spring.http.multipart.file-size-threshold=0 diff --git a/ax-boot-admin/src/main/resources/messages/messages.properties b/ax-boot-admin/src/main/resources/messages/messages.properties index 6e92bff0..c8fcbb04 100644 --- a/ax-boot-admin/src/main/resources/messages/messages.properties +++ b/ax-boot-admin/src/main/resources/messages/messages.properties @@ -1,7 +1,12 @@ -axboot.admin.search=조회 -axboot.admin.save=저장 -axboot.admin.logout=로그아웃 -axboot.admin.home=홈 -axboot.devtools=개발자도구 -axboot.admin.login=로그인 -axboot.admin.login.status.message={0}님 로그인 \ No newline at end of file +axboot.admin.search=Search +axboot.admin.save=Save +axboot.admin.logout=Logout +axboot.admin.home=Home +axboot.devtools=DevTools +axboot.admin.login=Login +axboot.admin.login.status.message={0} +axboot.admin.login.guide.message=Input your ID and Password +axboot.admin.find.id=Find ID +axboot.admin.find.password=Find Password +axboot.admin.id=ID +axboot.admin.password=Password \ No newline at end of file diff --git a/ax-boot-core/pom.xml b/ax-boot-core/pom.xml index 773f2192..c060415e 100644 --- a/ax-boot-core/pom.xml +++ b/ax-boot-core/pom.xml @@ -12,7 +12,7 @@ com.chequer.axboot ax-boot-framework - 2.1.0 + 2.1.1 diff --git a/ax-boot-initialzr/pom.xml b/ax-boot-initialzr/pom.xml index 6156b556..23d8dbfa 100644 --- a/ax-boot-initialzr/pom.xml +++ b/ax-boot-initialzr/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 ax-boot-initialzr - 2.1.0 + 2.1.1 war AX-Boot Initialzr AX-Boot Initialzr Application @@ -16,14 +16,14 @@ ax-boot-framework com.chequer.axboot - 2.1.0 + 2.1.1 com.chequer.axboot ax-boot-core - 2.1.14 + 2.1.19 diff --git a/ax-boot-initialzr/src/main/java/com/chequer/axboot/initialzr/service/ProjectGenerator.java b/ax-boot-initialzr/src/main/java/com/chequer/axboot/initialzr/service/ProjectGenerator.java index 06d9a2ac..b91ad8d1 100644 --- a/ax-boot-initialzr/src/main/java/com/chequer/axboot/initialzr/service/ProjectGenerator.java +++ b/ax-boot-initialzr/src/main/java/com/chequer/axboot/initialzr/service/ProjectGenerator.java @@ -52,7 +52,7 @@ public void generate(ProjectGenerateRequest projectGenerateRequest, HttpServletR values.put("description", description); values.put("groupId", groupId); values.put("sessionCookie", uuid); - values.put("axbootCoreVersion", "2.1.18"); + values.put("axbootCoreVersion", "2.1.19"); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); diff --git a/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplication.java b/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplication.java index dcd5a2b0..e0419356 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplication.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplication.java @@ -1,13 +1,10 @@ package ${basePackage}; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.PropertySource; -@Configuration -@ComponentScan -@EnableAutoConfiguration +@SpringBootApplication @PropertySource(value = {"classpath:axboot-common.properties", "classpath:axboot-${spring.profiles.active:local}.properties"}) public class AXBootApplication { } + diff --git a/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplicationInitializer.java b/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplicationInitializer.java index 61a449d3..827757be 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplicationInitializer.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/AXBootApplicationInitializer.java @@ -1,20 +1,18 @@ package ${basePackage}; -import org.springframework.boot.SpringApplication; import com.chequer.axboot.core.AXBootCoreConfiguration; +import org.springframework.boot.SpringApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Configuration; -import org.springframework.web.WebApplicationInitializer; @Configuration -public class AXBootApplicationInitializer extends SpringBootServletInitializer implements WebApplicationInitializer { +public class AXBootApplicationInitializer extends SpringBootServletInitializer { public static final Object[] APPLICATION_SOURCES = new Object[]{AXBootApplication.class, AXBootCoreConfiguration.class}; @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - this.setRegisterErrorPageFilter(false); return application.sources(APPLICATION_SOURCES); } diff --git a/ax-boot-initialzr/src/main/resources/templates/java/AXBootSecurityConfig.java b/ax-boot-initialzr/src/main/resources/templates/java/AXBootSecurityConfig.java index b19b7392..2502c525 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/AXBootSecurityConfig.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/AXBootSecurityConfig.java @@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; -import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -19,7 +18,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.Authentication; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; @@ -30,8 +28,8 @@ import java.io.IOException; @EnableWebSecurity -@Configuration @EnableGlobalMethodSecurity(securedEnabled = true, proxyTargetClass = true) +@Configuration public class AXBootSecurityConfig extends WebSecurityConfigurerAdapter { public static final String LOGIN_API = "/api/login"; @@ -92,7 +90,7 @@ protected void configure(HttpSecurity http) throws Exception { .logout().logoutUrl(LOGOUT_API).deleteCookies(GlobalConstants.ADMIN_AUTH_TOKEN_KEY, GlobalConstants.LAST_NAVIGATED_PAGE).logoutSuccessHandler(new LogoutSuccessHandler(LOGIN_PAGE)) .and() - .exceptionHandling().authenticationEntryPoint(new AXBootAuthenticationEntryPoint()).accessDeniedHandler(new AdminAccessDeniedHandler()) + .exceptionHandling().authenticationEntryPoint(new AXBootAuthenticationEntryPoint()) .and() .addFilterBefore(new AXBootLoginFilter(LOGIN_API, tokenAuthenticationService, userService, authenticationManager(), new AXBootAuthenticationEntryPoint()), UsernamePasswordAuthenticationFilter.class) @@ -140,11 +138,4 @@ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse resp super.onLogoutSuccess(request, response, authentication); } } - - class AdminAccessDeniedHandler implements AccessDeniedHandler { - @Override - public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { - System.out.println(request.getAuthType()); - } - } } diff --git a/ax-boot-initialzr/src/main/resources/templates/java/AXBootWebMvcConfigurerAdapter.java b/ax-boot-initialzr/src/main/resources/templates/java/AXBootWebMvcConfigurerAdapter.java index e8bdf747..deb3138a 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/AXBootWebMvcConfigurerAdapter.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/AXBootWebMvcConfigurerAdapter.java @@ -17,10 +17,15 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import org.springframework.beans.BeansException; import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.core.Ordered; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.converter.HttpMessageConverter; @@ -28,11 +33,15 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.View; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.i18n.CookieLocaleResolver; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; @@ -42,9 +51,12 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.Locale; @Configuration -public class AXBootWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter { +public class AXBootWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter implements ApplicationContextAware { + private ApplicationContext applicationContext; + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/assets/**").addResourceLocations("/assets/"); @@ -53,6 +65,32 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/favicon.ico").addResourceLocations("/static/favicon.ico"); } + @Override + public void addArgumentResolvers(List argumentResolvers) { + PageableHandlerMethodArgumentResolver pageableHandlerMethodArgumentResolver = new PageableHandlerMethodArgumentResolver(); + pageableHandlerMethodArgumentResolver.setPageParameterName("pageNumber"); + pageableHandlerMethodArgumentResolver.setSizeParameterName("pageSize"); + + argumentResolvers.add(new RequestParamsArgumentResolver()); + argumentResolvers.add(pageableHandlerMethodArgumentResolver); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(localeChangeInterceptor()); + } + + @Override + public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + + @Override + public void configureMessageConverters(List> converters) { + converters.add(stringHttpMessageConverter()); + converters.add(mappingJackson2HttpMessageConverter()); + } + @Bean @Primary public ObjectMapper objectMapper() { @@ -108,22 +146,6 @@ public ContentNegotiatingViewResolver contentNegotiatingViewResolver() { return contentNegotiatingViewResolver; } - @Override - public void addArgumentResolvers(List argumentResolvers) { - PageableHandlerMethodArgumentResolver pageableHandlerMethodArgumentResolver = new PageableHandlerMethodArgumentResolver(); - pageableHandlerMethodArgumentResolver.setPageParameterName("pageNumber"); - pageableHandlerMethodArgumentResolver.setSizeParameterName("pageSize"); - - argumentResolvers.add(new RequestParamsArgumentResolver()); - argumentResolvers.add(pageableHandlerMethodArgumentResolver); - } - - @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { - configurer.enable(); - super.configureDefaultServletHandling(configurer); - } - @Bean public FilterRegistrationBean multiReadableHttpServletRequestFilterRegistrationBean() { FilterRegistrationBean registrationBean = new FilterRegistrationBean(); @@ -153,9 +175,41 @@ public StringHttpMessageConverter stringHttpMessageConverter() { return new StringHttpMessageConverter(Charset.forName("UTF-8")); } + @Bean + public LocaleChangeInterceptor localeChangeInterceptor() { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + return localeChangeInterceptor; + } + + @Bean + public MessageSource messageSource() { + ReloadableResourceBundleMessageSource resourceBundleMessageSource = new ReloadableResourceBundleMessageSource(); + resourceBundleMessageSource.setBasename("classpath:messages/messages"); + resourceBundleMessageSource.setDefaultEncoding("UTF-8"); + resourceBundleMessageSource.setFallbackToSystemLocale(true); + + String[] activeProfiles = applicationContext.getEnvironment().getActiveProfiles(); + + if (activeProfiles != null && activeProfiles.length > 0 && activeProfiles[0].equals("local") || + Boolean.parseBoolean(System.getProperty("axboot.profiles.development"))) { + resourceBundleMessageSource.setCacheSeconds(1); + } + + return resourceBundleMessageSource; + } + + @Bean + public LocaleResolver localeResolver() { + CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver(); + cookieLocaleResolver.setCookieName("language"); + cookieLocaleResolver.setCookiePath("/"); + cookieLocaleResolver.setDefaultLocale(new Locale("ko_KR")); + return cookieLocaleResolver; + } + @Override - public void configureMessageConverters(List> converters) { - converters.add(stringHttpMessageConverter()); - converters.add(mappingJackson2HttpMessageConverter()); + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; } } diff --git a/ax-boot-initialzr/src/main/resources/templates/java/code/GlobalConstants.java b/ax-boot-initialzr/src/main/resources/templates/java/code/GlobalConstants.java index b50b9e3a..2f36b02f 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/code/GlobalConstants.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/code/GlobalConstants.java @@ -7,4 +7,8 @@ public class GlobalConstants { public static final String LAST_NAVIGATED_PAGE = "a_x_b_l_n_p"; public static final String ADMIN_AUTH_TOKEN_KEY = "${sessionCookie}"; + + public static final String LANGUAGE_COOKIE_KEY = "a_x_lang"; + + public static final String LANGUAGE_PARAMETER_KEY = "language"; } diff --git a/ax-boot-initialzr/src/main/resources/templates/java/config/CoreApplicationContext.java b/ax-boot-initialzr/src/main/resources/templates/java/config/CoreApplicationContext.java index 759a3f7f..4b40854b 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/config/CoreApplicationContext.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/config/CoreApplicationContext.java @@ -6,7 +6,7 @@ import com.chequer.axboot.core.db.dbcp.AXBootDataSourceFactory; import com.chequer.axboot.core.db.monitor.SqlMonitoringService; import com.chequer.axboot.core.domain.log.AXBootErrorLogService; -import com.chequer.axboot.core.logback.AXBootLogbackAppender; +import com.chequer.axboot.core.logging.AXBootLogbackAppender; import com.chequer.axboot.core.model.extract.service.jdbc.JdbcMetadataService; import com.chequer.axboot.core.mybatis.MyBatisMapper; import org.apache.ibatis.session.SqlSessionFactory; diff --git a/ax-boot-initialzr/src/main/resources/templates/java/security/AXBootTokenAuthenticationService.java b/ax-boot-initialzr/src/main/resources/templates/java/security/AXBootTokenAuthenticationService.java index 56352c51..3f9aab71 100644 --- a/ax-boot-initialzr/src/main/resources/templates/java/security/AXBootTokenAuthenticationService.java +++ b/ax-boot-initialzr/src/main/resources/templates/java/security/AXBootTokenAuthenticationService.java @@ -1,5 +1,6 @@ package ${basePackage}.security; +import ${basePackage}.code.GlobalConstants; import ${basePackage}.code.GlobalConstants; import ${basePackage}.domain.program.Program; import ${basePackage}.domain.program.ProgramService; @@ -13,6 +14,7 @@ import com.chequer.axboot.core.utils.*; import com.chequer.axboot.core.vo.ScriptSessionVO; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -68,6 +70,11 @@ public Authentication getAuthentication(HttpServletRequest request, HttpServletR final String progCd = FilenameUtils.getBaseName(request.getServletPath()); final Long menuId = requestUtils.getLong("menuId"); final String requestUri = request.getRequestURI(); + final String language = requestUtils.getString(GlobalConstants.LANGUAGE_PARAMETER_KEY, ""); + + if (StringUtils.isNotEmpty(language)) { + CookieUtils.addCookie(response, GlobalConstants.LANGUAGE_COOKIE_KEY, language); + } if (token == null) { return deleteCookieAndReturnNullAuthentication(request, response); diff --git a/ax-boot-initialzr/src/main/resources/templates/resources/axboot-common.properties b/ax-boot-initialzr/src/main/resources/templates/resources/axboot-common.properties index 808eab2d..00dedc9d 100755 --- a/ax-boot-initialzr/src/main/resources/templates/resources/axboot-common.properties +++ b/ax-boot-initialzr/src/main/resources/templates/resources/axboot-common.properties @@ -1,9 +1,6 @@ # IDENTITY spring.application.name=AXBoot -# AutoConfigure Exclude -#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration - # Multipart spring.http.multipart.enabled=true spring.http.multipart.file-size-threshold=0 diff --git a/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages.properties b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages.properties new file mode 100644 index 00000000..c8fcbb04 --- /dev/null +++ b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages.properties @@ -0,0 +1,12 @@ +axboot.admin.search=Search +axboot.admin.save=Save +axboot.admin.logout=Logout +axboot.admin.home=Home +axboot.devtools=DevTools +axboot.admin.login=Login +axboot.admin.login.status.message={0} +axboot.admin.login.guide.message=Input your ID and Password +axboot.admin.find.id=Find ID +axboot.admin.find.password=Find Password +axboot.admin.id=ID +axboot.admin.password=Password \ No newline at end of file diff --git a/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_en.properties b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_en.properties new file mode 100644 index 00000000..c8fcbb04 --- /dev/null +++ b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_en.properties @@ -0,0 +1,12 @@ +axboot.admin.search=Search +axboot.admin.save=Save +axboot.admin.logout=Logout +axboot.admin.home=Home +axboot.devtools=DevTools +axboot.admin.login=Login +axboot.admin.login.status.message={0} +axboot.admin.login.guide.message=Input your ID and Password +axboot.admin.find.id=Find ID +axboot.admin.find.password=Find Password +axboot.admin.id=ID +axboot.admin.password=Password \ No newline at end of file diff --git a/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_ko.properties b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_ko.properties new file mode 100644 index 00000000..bd9ac476 --- /dev/null +++ b/ax-boot-initialzr/src/main/resources/templates/resources/messages/messages_ko.properties @@ -0,0 +1,12 @@ +axboot.admin.search=조회 +axboot.admin.save=저장 +axboot.admin.logout=로그아웃 +axboot.admin.home=홈 +axboot.devtools=개발자도구 +axboot.admin.login=로그인 +axboot.admin.login.status.message={0}님 로그인 +axboot.admin.login.guide.message=아이디와 패스워드를 입력해주세요 +axboot.admin.find.id=아이디 찾기 +axboot.admin.find.password=패스워드 찾기 +axboot.admin.id=아이디 +axboot.admin.password=패스워드 \ No newline at end of file diff --git a/ax-boot-initialzr/src/main/resources/templates/root/pom.xml b/ax-boot-initialzr/src/main/resources/templates/root/pom.xml index 5fee270e..5d401573 100644 --- a/ax-boot-initialzr/src/main/resources/templates/root/pom.xml +++ b/ax-boot-initialzr/src/main/resources/templates/root/pom.xml @@ -30,7 +30,7 @@ com.chequer.axboot ax-boot-framework - 2.1.0 + 2.1.1 diff --git a/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/layout/frame.tag b/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/layout/frame.tag index a45390f7..ea845e99 100644 --- a/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/layout/frame.tag +++ b/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/layout/frame.tag @@ -1,6 +1,7 @@ <%@ tag import="${basePackage}.utils.CommonCodeUtils" %> <%@ tag import="com.chequer.axboot.core.utils.ContextUtil" %> <%@ tag import="com.chequer.axboot.core.utils.PhaseUtils" %> +<%@ taglib prefix="ax" tagdir="/WEB-INF/tags" %> <%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless" %> <% String commonCodeJson = CommonCodeUtils.getAllByJson(); @@ -53,19 +54,19 @@
- ${loginUser.userNm}님 로그인 +
diff --git a/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/message.tag b/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/message.tag new file mode 100644 index 00000000..da8acaad --- /dev/null +++ b/ax-boot-initialzr/src/main/resources/templates/webapp/WEB-INF/tags/message.tag @@ -0,0 +1,49 @@ +<%@ tag import="com.chequer.axboot.core.context.AppContextManager" %> +<%@ tag import="org.springframework.context.MessageSource" %> +<%@ tag import="org.springframework.web.servlet.i18n.CookieLocaleResolver" %> +<%@ tag import="java.util.Locale" %> +<%@ tag import="com.chequer.axboot.core.utils.CookieUtils" %> +<%@ tag import="org.apache.commons.lang3.StringUtils" %> +<%@ tag import="com.chequer.axboot.core.utils.SessionUtils" %> +<%@ tag import="sun.applet.resources.MsgAppletViewer_zh_CN" %> +<%@ tag import="com.chequer.axboot.core.utils.RequestUtils" %> +<%@ tag import="${basePackage}.code.GlobalConstants" %> +<%@ tag language="java" pageEncoding="UTF-8" body-content="empty" %> +<%@ attribute name="code" required="true" %> +<%@ attribute name="arguments" %> +<% + MessageSource messageSource = AppContextManager.getBean(MessageSource.class); + + RequestUtils requestUtils = RequestUtils.of(request); + String language = requestUtils.getString(GlobalConstants.LANGUAGE_PARAMETER_KEY); + + Locale locale; + + if (StringUtils.isNotEmpty(language)) { + locale = new Locale(language); + } else { + Object requestAttributeLocale = request.getAttribute(CookieLocaleResolver.LOCALE_REQUEST_ATTRIBUTE_NAME); + + if (requestAttributeLocale != null) { + locale = (Locale) requestAttributeLocale; + } else { + String localeCookie = CookieUtils.getCookieValue(request, GlobalConstants.LANGUAGE_COOKIE_KEY); + + if (StringUtils.isNotEmpty(localeCookie)) { + locale = new Locale(localeCookie); + } else { + locale = new Locale(SessionUtils.getCurrentUser().getLocale().getLanguage()); + } + } + } + + String message = ""; + + if (StringUtils.isNotEmpty(arguments)) { + message = messageSource.getMessage(code, arguments.split(","), locale); + } else { + message = messageSource.getMessage(code, null, locale); + } +%> + +<%=message%> \ No newline at end of file diff --git a/ax-boot-initialzr/src/main/resources/templates/webapp/jsp/axpi/index.jsp b/ax-boot-initialzr/src/main/resources/templates/webapp/jsp/axpi/index.jsp index c4c9f2ce..6e586d3d 100644 --- a/ax-boot-initialzr/src/main/resources/templates/webapp/jsp/axpi/index.jsp +++ b/ax-boot-initialzr/src/main/resources/templates/webapp/jsp/axpi/index.jsp @@ -3,7 +3,7 @@ - Database Schema to JPA Objects + AXBoot DevTools @@ -37,25 +37,25 @@ my_dialog.prompt({ theme: 'good', width: 300, - title: 'AXBOOT Generated Code', + title: 'AXBOOT Code Generator', input: { data1: {label:"Package Name"}, data2: {label:"Class Name"} } }, function () { - //console.log(this.value); - - ax5.xhr({ - method: "GET", - url: "${copyLink}&templateTypes=Controller,Entity,Repository,Service&packageName=" + this.data1 + "&className=" + this.data2, - param: "", - res: function (response, status) { - alert("Success"); - }, - error: function () { - - } - }); + if(this.key == 'ok') { + ax5.xhr({ + method: "GET", + url: "${copyLink}&templateTypes=Controller,Entity,Repository,Service&packageName=" + this.data1 + "&className=" + this.data2, + param: "", + res: function (response, status) { + alert("Code Generated"); + }, + error: function () { + } + }); + } + console.log(this); }); } @@ -74,63 +74,44 @@
-

- Generated Code - - +

+ Code +

-

Controller / - Download -

+

Controller

${jpaMvcModel.getController().code()}
-

Entity / - Download -

+

Entity

${jpaMvcModel.getEntity().code()}
-

VO / - Download -

+

VO

${jpaMvcModel.getVo().code()}
-

Service / - Download - -

+

Service

${jpaMvcModel.getService().code()}
-

Repository / - Download - -

+

Repository

${jpaMvcModel.getRepository().code()}
-

MyBatis-Interface / - Download - -

+

MyBatis-Interface

${jpaMvcModel.getMyBatisInterface().code()}
-

MyBatis-XML / - Download - -

+

MyBatis-XML

${jpaMvcModel.getMyBatisXML().code()}
diff --git a/pom.xml b/pom.xml index 95ebc6a6..0edf18c9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.chequer.axboot ax-boot-framework - 2.1.0 + 2.1.1 pom AX Boot Parent AX Boot Framework @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 1.4.1.RELEASE + 1.4.2.RELEASE