diff --git a/modules/core/pom.xml b/modules/core/pom.xml index 1464a07f..0b1555b6 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -1,55 +1,55 @@ - - - 4.0.0 - - - com.jeesite - jeesite-parent - 4.0-SNAPSHOT - ../../parent/pom.xml - - - jeesite-module-core - jar - - JeeSite Module Core - http://jeesite.com - 2013-Now - - - - - - - - - com.jeesite - jeesite-framework - ${project.parent.version} - - - - - - - - - - - - - thinkgem - WangZhen - thinkgem at 163.com - Project lead - +8 - - - - - JeeSite - http://jeesite.com - - - + + + 4.0.0 + + + com.jeesite + jeesite-parent + 4.0-SNAPSHOT + ../../parent/pom.xml + + + jeesite-module-core + jar + + JeeSite Module Core + http://jeesite.com + 2013-Now + + + + + + + + + com.jeesite + jeesite-framework + ${project.parent.version} + + + + + + + + + + + + + thinkgem + WangZhen + thinkgem at 163.com + Project lead + +8 + + + + + JeeSite + http://jeesite.com + + + diff --git a/modules/core/src/main/java/com/jeesite/config/spring/ShiroConfig.java b/modules/core/src/main/java/com/jeesite/config/spring/ShiroConfig.java new file mode 100644 index 00000000..b3562933 --- /dev/null +++ b/modules/core/src/main/java/com/jeesite/config/spring/ShiroConfig.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.spring; + +import java.util.Map; + +import javax.servlet.Filter; + +import org.apache.shiro.cache.CacheManager; +import org.apache.shiro.cas.CasSubjectFactory; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; + +import com.jeesite.common.config.Global; +import com.jeesite.common.shiro.cas.CasOutHandler; +import com.jeesite.common.shiro.config.FilterChainDefinitionMap; +import com.jeesite.common.shiro.filter.CasAuthenticationFilter; +import com.jeesite.common.shiro.filter.FormAuthenticationFilter; +import com.jeesite.common.shiro.filter.PermissionsAuthorizationFilter; +import com.jeesite.common.shiro.filter.UserFilter; +import com.jeesite.common.shiro.realm.AuthorizingRealm; +import com.jeesite.common.shiro.session.SessionDAO; +import com.jeesite.common.shiro.session.SessionManager; +import com.jeesite.common.shiro.web.ShiroFilterFactoryBean; +import com.jeesite.common.shiro.web.WebSecurityManager; +import com.jeesite.modules.sys.service.EmpUserService; +import com.jeesite.modules.sys.service.UserService; + +/** + * Shiro配置 + * @author ThinkGem + * @version 2017年11月30日 + */ +@SuppressWarnings("deprecation") +@Configuration +public class ShiroConfig { + + /** + * 单点登录信息句柄,单点退出用 + */ + @Bean + public CasOutHandler casOutHandler() { + return new CasOutHandler(); + } + + /** + * 系统安全认证实现类 + */ + @Bean + public AuthorizingRealm authorizingRealm(SessionDAO sessionDAO, UserService userService, + EmpUserService empUserService, CasOutHandler casOutHandler) { + AuthorizingRealm bean = new AuthorizingRealm(); + bean.setCachingEnabled(false); + bean.setSessionDAO(sessionDAO); + bean.setUserService(userService); + bean.setEmpUserService(empUserService); + bean.setCasOutHandler(casOutHandler); + bean.setCasServerUrl(Global.getProperty("shiro.casServerUrl")); + bean.setCasServerCallbackUrl(Global.getProperty("shiro.casClientUrl") + Global.getAdminPath() + "/login-cas"); + return bean; + } + + /** + * CAS登录过滤器 + */ + @Bean + public CasAuthenticationFilter shiroCasFilter(AuthorizingRealm authorizingRealm) { + CasAuthenticationFilter bean = new CasAuthenticationFilter(); + bean.setAuthorizingRealm(authorizingRealm); + return bean; + } + + /** + * Form登录过滤器 + */ + @Bean + public FormAuthenticationFilter shiroAuthcFilter(AuthorizingRealm authorizingRealm) { + FormAuthenticationFilter bean = new FormAuthenticationFilter(); + bean.setAuthorizingRealm(authorizingRealm); + return bean; + } + +// /** +// * 登出过滤器 +// */ +// @Bean +// public LogoutFilter shiroLogoutFilter() { +// return new LogoutFilter(); +// } + + /** + * 权限字符串过滤器 + */ + @Bean + public PermissionsAuthorizationFilter shiroPermsFilter() { + return new PermissionsAuthorizationFilter(); + } + +// /** +// * 角色权限过滤器 +// */ +// @Bean +// public RolesAuthorizationFilter shiroRolesFilter() { +// return new RolesAuthorizationFilter(); +// } + + /** + * 用户权限过滤器 + */ + @Bean + public UserFilter shiroUserFilter() { + return new UserFilter(); + } + + /** + * URL过滤定义 + */ + @Bean + public FilterChainDefinitionMap shiroFilterChainDefinitionMap() { + FilterChainDefinitionMap bean = new FilterChainDefinitionMap(); + bean.setFilterChainDefinitions(Global.getProperty("shiro.filterChainDefinitions")); + bean.setDefaultFilterChainDefinitions(Global.getProperty("shiro.defaultFilterChainDefinitions")); + return bean; + } + + /** + * Shiro认证过滤器 + */ + @Bean + public ShiroFilterFactoryBean shiroFilter(WebSecurityManager securityManager, CasAuthenticationFilter shiroCasFilter, + FormAuthenticationFilter shiroAuthcFilter, +// LogoutFilter shiroLogoutFilter, + PermissionsAuthorizationFilter shiroPermsFilter, +// RolesAuthorizationFilter shiroRolesFilter, + UserFilter shiroUserFilter, FilterChainDefinitionMap shiroFilterChainDefinitionMap) { + ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean(); + bean.setSecurityManager(securityManager); + bean.setLoginUrl(Global.getProperty("shiro.loginUrl")); + bean.setSuccessUrl(Global.getProperty("shiro.successUrl")); + Map filters = bean.getFilters(); + filters.put("cas", shiroCasFilter); + filters.put("authc", shiroAuthcFilter); +// filters.put("logout", shiroLogoutFilter); + filters.put("perms", shiroPermsFilter); +// filters.put("roles", shiroRolesFilter); + filters.put("user", shiroUserFilter); + bean.setFilterChainDefinitionMap(shiroFilterChainDefinitionMap.getObject()); + return bean; + } + + /** + * 定义Shiro安全管理配置 + */ + @Bean + public WebSecurityManager securityManager(AuthorizingRealm authorizingRealm, SessionManager sessionManager, CacheManager shiroCacheManager) { + WebSecurityManager bean = new WebSecurityManager(); + bean.setRealm(authorizingRealm); + bean.setSessionManager(sessionManager); + bean.setCacheManager(shiroCacheManager); + // 设置支持CAS的subjectFactory + bean.setSubjectFactory(new CasSubjectFactory()); + return bean; + } + +} diff --git a/modules/core/src/main/resources/jeesite-core.yml b/modules/core/src/main/resources/jeesite-core.yml index 0a274c47..725590c0 100644 --- a/modules/core/src/main/resources/jeesite-core.yml +++ b/modules/core/src/main/resources/jeesite-core.yml @@ -80,7 +80,7 @@ jdbc: redis: # 是否启用 Redis - enable: false + enabled: false # Redis 连接参数 host: 192.168.11.12 @@ -101,14 +101,6 @@ redis: # 是否启用Redis系统缓存及会话 cacheAndSession: false -# Mapper文件刷新线程 -mapperRefresh: - - enabled: true - delaySeconds: 60 - sleepSeconds: 3 - mappingPath: mappings - #============================# #===== System settings ======# #============================# @@ -131,6 +123,12 @@ frontPath: /f #索引页路径 defaultPath: ${adminPath}/login +# 分页配置 +page: + + # 分页默认大小 + pageSize: 20 + # 用户相关参数 user: @@ -185,12 +183,6 @@ user: # 集团模式(多公司、多租户、SAAS模式) useCorpModel: false -# 分页配置 -page: - - # 分页默认大小 - pageSize: 20 - # 任务调度 job: @@ -311,6 +303,14 @@ mybatis: # 扫描基础包设置(Aliases、@MyBatisDao),如果多个,用“,”分隔 scanBasePackage: com.jeesite.modules + # Mapper文件刷新线程 + mapper: + refresh: + enabled: true + delaySeconds: 60 + sleepSeconds: 3 + mappingPath: mappings + # 缓存设置 ehcache: @@ -321,6 +321,11 @@ ehcache: # 清理缓存的缓存名称 clearNames: sysCache,userCache,corpCache,cmsCache,pageCachingFilter + # 页面缓存配置 + pageCaching: + enabled: false + urlPatterns: "*.html" + # Web 相关 web: @@ -332,6 +337,17 @@ web: # 引入页面为不:'/themes/'+themeName+'/include/footer.html' themeName: default + # MVC 拦截器 + interceptor: + + # 后台管理日志记录拦截器 + log: + enabled: true + + # 前台自动切换到手机视图拦截器 + mobile: + enabled: false + # 静态文件后缀,过滤静态文件,以提高访问性能。 staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2 diff --git a/modules/core/src/main/resources/spring/spring-context-core.xml b/modules/core/src/main/resources/spring/spring-context-core.xml deleted file mode 100644 index c26f7b06..00000000 --- a/modules/core/src/main/resources/spring/spring-context-core.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - Spring Configuration - - - - - classpath:jeesite-core.yml - classpath:jeesite.yml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-data-stat.xml b/modules/core/src/main/resources/spring/spring-context-data-stat.xml deleted file mode 100644 index ee3518fe..00000000 --- a/modules/core/src/main/resources/spring/spring-context-data-stat.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Spring Redis Configuration - - - - - - com.jeesite..*.service..*.* - - - com.jeesite..*.service..*Dao.* - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-data.xml b/modules/core/src/main/resources/spring/spring-context-data.xml deleted file mode 100644 index 985a1d99..00000000 --- a/modules/core/src/main/resources/spring/spring-context-data.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - MyBatis Configuration - - - - - - - - - - ${jdbc.tablePrefix} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-jedis.xml b/modules/core/src/main/resources/spring/spring-context-jedis.xml deleted file mode 100644 index c157b483..00000000 --- a/modules/core/src/main/resources/spring/spring-context-jedis.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - Jedis Configuration - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-shiro-ehcache.xml b/modules/core/src/main/resources/spring/spring-context-shiro-ehcache.xml deleted file mode 100644 index 6f42ad2c..00000000 --- a/modules/core/src/main/resources/spring/spring-context-shiro-ehcache.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Spring EhCache Configuration - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-shiro-redis.xml b/modules/core/src/main/resources/spring/spring-context-shiro-redis.xml deleted file mode 100644 index 76c8ac7f..00000000 --- a/modules/core/src/main/resources/spring/spring-context-shiro-redis.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Spring Redis Configuration - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-shiro.xml b/modules/core/src/main/resources/spring/spring-context-shiro.xml deleted file mode 100644 index e0c2fcdf..00000000 --- a/modules/core/src/main/resources/spring/spring-context-shiro.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - Shiro Configuration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-context-test.xml b/modules/core/src/main/resources/spring/spring-context-test.xml deleted file mode 100644 index aab57aa8..00000000 --- a/modules/core/src/main/resources/spring/spring-context-test.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - Spring Configuration Test - - - - - classpath:jeesite-core.yml - classpath:jeesite.yml - - - - - - - - - - - - com.jeesite - - - - - - - - - - - - - - ${jdbc.tablePrefix} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-mvc-core.xml b/modules/core/src/main/resources/spring/spring-mvc-core.xml deleted file mode 100644 index 7806c9dc..00000000 --- a/modules/core/src/main/resources/spring/spring-mvc-core.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - Spring MVC Configuration - - - - - classpath:jeesite-core.yml - classpath:jeesite.yml - - - - - - - - - - - - - - - - - - - - - - - - - - - json=application/json - xml=application/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - error/403 - error/403 - error/500 - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-mvc-interceptor-log.xml b/modules/core/src/main/resources/spring/spring-mvc-interceptor-log.xml deleted file mode 100644 index 1f3debf1..00000000 --- a/modules/core/src/main/resources/spring/spring-mvc-interceptor-log.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - Spring MVC Log Interceptor Configuration - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/core/src/main/resources/spring/spring-mvc-interceptor-mobile.xml b/modules/core/src/main/resources/spring/spring-mvc-interceptor-mobile.xml deleted file mode 100644 index 4dbc0d1c..00000000 --- a/modules/core/src/main/resources/spring/spring-mvc-interceptor-mobile.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - Spring MVC Log Interceptor Configuration - - - - - - - - - - - \ No newline at end of file diff --git a/web/bin/init-db.bat b/web/bin/init-data.bat similarity index 93% rename from web/bin/init-db.bat rename to web/bin/init-data.bat index 7ff092ca..3ac1a643 100644 --- a/web/bin/init-db.bat +++ b/web/bin/init-data.bat @@ -20,6 +20,7 @@ echo. pause echo. +%~d0 cd %~dp0 cd ../ diff --git a/web/bin/package.bat b/web/bin/package.bat index 03131d32..8f8c33ee 100644 --- a/web/bin/package.bat +++ b/web/bin/package.bat @@ -5,7 +5,7 @@ rem * rem * Author: ThinkGem@163.com rem */ echo. -echo [Ϣ] Weḅwarļ +echo [Ϣ] Weḅwar/jarļ echo. pause echo. @@ -14,6 +14,6 @@ echo. cd %~dp0 cd ../ -call mvn clean package -Dmaven.test.skip=true -Ppackage -U +call mvn clean package spring-boot:repackage -Dmaven.test.skip=true -U pause \ No newline at end of file diff --git a/web/bin/run-jetty.bat b/web/bin/run-jetty.bat deleted file mode 100644 index af57e678..00000000 --- a/web/bin/run-jetty.bat +++ /dev/null @@ -1,34 +0,0 @@ -@echo off -rem /** -rem * Copyright (c) 2013-Now http://jeesite.com All rights reserved. -rem * -rem * Author: ThinkGem@163.com -rem */ -title %cd% -echo. -echo [Ϣ] ʹJettyWeb̡ -echo. -rem pause -rem echo. - -cd %~dp0 -cd .. -set currPath=%cd% - -set MAVEN_OPTS=%MAVEN_OPTS% -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m - -if exist "../parent/pom.xml" ( - cd ../parent - call mvn clean install -Dmaven.test.skip=true -) - -if exist "../modules/pom.xml" ( - cd ../modules - call mvn clean install -Dmaven.test.skip=true -) - -cd %currPath% -call mvn jetty:run -D maven.javadoc.skip=true -U - -cd bin -pause \ No newline at end of file diff --git a/web/bin/run-tomcat.bat b/web/bin/run-tomcat.bat new file mode 100644 index 00000000..0643cb3a --- /dev/null +++ b/web/bin/run-tomcat.bat @@ -0,0 +1,32 @@ +@echo off +rem /** +rem * Copyright (c) 2013-Now http://jeesite.com All rights reserved. +rem * +rem * Author: ThinkGem@163.com +rem */ +echo. +echo [Ϣ] ʹ Spring Boot Tomcat Web ̡ +echo. +rem pause +rem echo. + +%~d0 +cd %~dp0 + +cd ../ +title %cd% + +set currPath=%cd% + +set MAVEN_OPTS=%MAVEN_OPTS% -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m + +if exist "../package/pom.xml" ( + cd ../package + call mvn clean install -Dmaven.test.skip=true -Ppackage -U +) + +cd %currPath% + +call mvn clean spring-boot:run -U + +pause \ No newline at end of file diff --git a/web/bin/run-tomcat.sh b/web/bin/run-tomcat.sh new file mode 100644 index 00000000..102d06ae --- /dev/null +++ b/web/bin/run-tomcat.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# /** +# * Copyright (c) 2013-Now http://jeesite.com All rights reserved. +# * +# * Author: ThinkGem@163.com +# */ + +cd ../ + +MAVEN_OPTS=$MAVEN_OPTS -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m + +exec mvn clean spring-boot:run -U diff --git a/web/bin/startup.bat b/web/bin/startup.bat new file mode 100644 index 00000000..b81510ec --- /dev/null +++ b/web/bin/startup.bat @@ -0,0 +1,23 @@ +@echo off +rem /** +rem * Copyright (c) 2013-Now http://jeesite.com All rights reserved. +rem * +rem * Author: ThinkGem@163.com +rem */ +echo. +echo [Ϣ] Web ̡ +echo. +rem pause +rem echo. + +%~d0 +cd %~dp0 + +cd ../ +title %cd% + +set JAVA_OPTS= -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m + +java -jar target/jeesite-web-4.0-SNAPSHOT.war + +pause \ No newline at end of file diff --git a/web/pom.xml b/web/pom.xml index fabab556..b1e1ff62 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -1,219 +1,180 @@ - - - 4.0.0 - - - com.jeesite - jeesite-parent - 4.0-SNAPSHOT - ../parent/pom.xml - - - jeesite-web - war - - JeeSite Web - http://jeesite.com - 2013-Now - - - - 1.5.9.RELEASE - - - 2.2 - 8.1.0.RC5 - 8080 - false - false - - - - - - - - com.jeesite - jeesite-module-core - ${project.parent.version} - - - - - com.jeesite - jeesite-module-devtools - ${project.parent.version} - - - - - - - - - - - - - - - - ${project.basedir}/src/main/webapp/WEB-INF/classes/ - - - - - org.apache.maven.plugins - maven-war-plugin - - - - - userfiles/**, - test/** - - ${project.build.directory}/${project.artifactId} - ${project.artifactId} - - false - - false - - - - - - org.apache.maven.plugins - maven-eclipse-plugin - - ${downloadSources} - ${downloadJavadocs} - ${project.artifactId} - 2.0 - 6.0 - - - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - ${tomcat.version} - - ${webserver.port} - /${project.artifactId} - ${project.build.sourceEncoding} - - - - - - org.mortbay.jetty - jetty-maven-plugin - ${jetty.version} - - - - ${webserver.port} - - - - /${project.artifactId} - - - - org.mortbay.util.URI.charset - ${project.build.sourceEncoding} - - - - - - - - - - - thinkgem - WangZhen - thinkgem at 163.com - Project lead - +8 - - - - - JeeSite - http://jeesite.com - - - - - - aliyun-repos - Aliyun Repository - http://maven.aliyun.com/nexus/content/groups/public - true - false - - - sonatype-repos - Sonatype Repository - https://oss.sonatype.org/content/groups/public - true - false - - - sonatype-repos-s - Sonatype Repository - https://oss.sonatype.org/content/repositories/snapshots - false - true - - - - - - - - aliyun-repos - Aliyun Repository - http://maven.aliyun.com/nexus/content/groups/public - - - sonatype-repos - Sonatype Repository - https://oss.sonatype.org/content/groups/public - - - - - + + + 4.0.0 + + + com.jeesite + jeesite-parent + 4.0-SNAPSHOT + ../parent/pom.xml + + + jeesite-web + war + + JeeSite Boot + http://jeesite.com + 2013-Now + + + + com.jeesite.config.Application + false + false + + + + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + + com.jeesite + jeesite-module-core + ${project.parent.version} + + + + + com.jeesite + jeesite-module-devtools + ${project.parent.version} + + + + + + + + + + + + ${project.basedir}/src/main/webapp/WEB-INF/classes/ + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-shade-plugin + + + + + org.apache.maven.plugins + maven-war-plugin + + + + + userfiles/**, + test/** + + ${project.build.directory}/${project.artifactId} + ${project.artifactId} + + false + + false + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + ${eclipse-plugin-download-sources} + ${eclipse-plugin-download-javadocs} + ${project.artifactId} + 2.0 + 6.0 + + + + + + + + + thinkgem + WangZhen + thinkgem at 163.com + Project lead + +8 + + + + + JeeSite + http://jeesite.com + + + + + + aliyun-repos + Aliyun Repository + http://maven.aliyun.com/nexus/content/groups/public + true + false + + + sonatype-repos + Sonatype Repository + https://oss.sonatype.org/content/groups/public + true + false + + + sonatype-repos-s + Sonatype Repository + https://oss.sonatype.org/content/repositories/snapshots + false + true + + + + + + + + aliyun-repos + Aliyun Repository + http://maven.aliyun.com/nexus/content/groups/public + + + sonatype-repos + Sonatype Repository + https://oss.sonatype.org/content/groups/public + + + + + diff --git a/web/src/main/java/com/jeesite/config/Application.java b/web/src/main/java/com/jeesite/config/Application.java new file mode 100644 index 00000000..4b3b19d6 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/Application.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; + +import com.jeesite.common.io.PropertiesUtils; + +/** + * JeeSite Web + * @author ThinkGem + * @version 2018-1-8 + */ +@SpringBootApplication(scanBasePackages={"com.jeesite.config"}) +public class Application extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication app = new SpringApplication(Application.class); + app.setDefaultProperties(PropertiesUtils.getInstance().getProperties()); + app.run(args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + builder.properties(PropertiesUtils.getInstance().getProperties()); + return builder.sources(Application.class); + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/jeesite/config/task/MsgLocalSendTask.java b/web/src/main/java/com/jeesite/config/task/MsgLocalSendTask.java new file mode 100644 index 00000000..e3f113b1 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/task/MsgLocalSendTask.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.task; + +/** + * 消息发送服务,如果需要支持定时任务,则要在作业管理里添加该任务:msgLocalSendTask.execute(); + * @author ThinkGem + * @version 2018年1月10日 + */ +public class MsgLocalSendTask { + +// +// +// +// +// +// +// +// +// +// +// +// +// +// --> + +} diff --git a/web/src/main/java/com/jeesite/config/web/DruidStatConfig.java b/web/src/main/java/com/jeesite/config/web/DruidStatConfig.java new file mode 100644 index 00000000..12080ee8 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/DruidStatConfig.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web; + +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.alibaba.druid.support.http.StatViewServlet; +import com.alibaba.druid.support.http.WebStatFilter; + +/** + * Servlet 配置 + * @author ThinkGem + * @version 2017年11月30日 + */ +@Configuration +public class DruidStatConfig { + + /** + * 注册DruidFilter拦截 + */ + @Bean + public FilterRegistrationBean duridFilter() { + FilterRegistrationBean bean = new FilterRegistrationBean(); + bean.setFilter(new WebStatFilter()); + bean.addInitParameter("exclusions", "*.css,*.js,*.png," + + "*.jpg,*.gif,*.jpeg,*.bmp,*.ico,*.swf,*.psd,*.htc,*.htm,*.html," + + "*.crx,*.xpi,*.exe,*.ipa,*.apk,*.otf,*.eot,*.svg,*.ttf,*.woff," + + "/druid/*"); + bean.addUrlPatterns("/*"); + return bean; + } + + /** + * 注册DruidServlet + */ + @Bean + public ServletRegistrationBean druidServlet() { + ServletRegistrationBean bean = new ServletRegistrationBean(); + bean.setServlet(new StatViewServlet()); + bean.addUrlMappings("/druid/*"); + return bean; + } + +} diff --git a/web/src/main/java/com/jeesite/config/web/FilterConfig.java b/web/src/main/java/com/jeesite/config/web/FilterConfig.java new file mode 100644 index 00000000..16bf0880 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/FilterConfig.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.CharacterEncodingFilter; +import org.springframework.web.filter.DelegatingFilterProxy; +import org.springframework.web.filter.RequestContextFilter; + +import com.jeesite.common.config.Global; +import com.jeesite.common.web.PageCachingFilter; + +/** + * Filter 配置 + * @author ThinkGem + * @version 2017年11月30日 + */ +@Configuration +public class FilterConfig { + + /** + * Encoding Filter + */ + @Bean + public FilterRegistrationBean characterEncodingFilter() { + FilterRegistrationBean bean = new FilterRegistrationBean(); + bean.setFilter(new CharacterEncodingFilter()); + bean.addInitParameter("encoding", "UTF-8"); + bean.addInitParameter("forceEncoding", "true"); + bean.addUrlPatterns("/*"); + bean.setOrder(1000); + return bean; + } + + /** + * PageCache Filter, cache .html suffix. + */ + @Bean + @ConditionalOnProperty(name = "ehcache.pageCaching.enabled", havingValue = "true") + public FilterRegistrationBean pageCachingFilter(EhCacheManagerFactoryBean ehCacheManager) { + FilterRegistrationBean bean = new FilterRegistrationBean(); + PageCachingFilter pageCachingFilter = new PageCachingFilter(); + pageCachingFilter.setCacheManager(ehCacheManager.getObject()); + bean.setFilter(pageCachingFilter); + bean.addInitParameter("cacheName", "pageCachingFilter"); + bean.addUrlPatterns(StringUtils.split(Global.getProperty( + "ehcache.pageCaching.urlPatterns"), ",")); + bean.setOrder(2000); + return bean; + } + + /** + * Apache Shiro Filter + */ + @Bean + public FilterRegistrationBean shiroFilterProxy() { + FilterRegistrationBean bean = new FilterRegistrationBean(); + bean.setFilter(new DelegatingFilterProxy("shiroFilter")); + bean.addInitParameter("targetFilterLifecycle", "true"); + bean.addUrlPatterns("/*"); + bean.setOrder(3000); + return bean; + } + + /** + * Request Context Filter 需要放在shiroFilter后,否则request获取不到session + */ + @Bean + public FilterRegistrationBean requestContextFilter() { + FilterRegistrationBean bean = new FilterRegistrationBean(); + bean.setFilter(new RequestContextFilter()); + bean.addUrlPatterns("/*"); + bean.setOrder(4000); + return bean; + } + +} diff --git a/web/src/main/java/com/jeesite/config/web/ListenerConfig.java b/web/src/main/java/com/jeesite/config/web/ListenerConfig.java new file mode 100644 index 00000000..b61cd616 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/ListenerConfig.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web; + +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.context.request.RequestContextListener; + +import com.jeesite.common.shiro.cas.CasOutSessionListener; + +/** + * Listener 配置 + * @author ThinkGem + * @version 2017年11月29日 + */ +@Configuration +public class ListenerConfig { + + /** + * CAS Session Listener + */ + @Bean + public ServletListenerRegistrationBean casOutSessionListener() { + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean<>(); + bean.setListener(new CasOutSessionListener()); + bean.setOrder(1000); + return bean; + } + + /** + * Request Context Listener + */ + @Bean + public ServletListenerRegistrationBean requestContextListener() { + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean<>(); + bean.setListener(new RequestContextListener()); + bean.setOrder(2000); + return bean; + } + +} diff --git a/web/src/main/java/com/jeesite/config/web/ServletConfig.java b/web/src/main/java/com/jeesite/config/web/ServletConfig.java new file mode 100644 index 00000000..497056dc --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/ServletConfig.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web; + +import org.springframework.context.annotation.Configuration; + +/** + * Servlet 配置 + * @author ThinkGem + * @version 2017年11月30日 + */ +@Configuration +public class ServletConfig { + +} diff --git a/web/src/main/java/com/jeesite/config/web/interceptor/LogInterceptorConfig.java b/web/src/main/java/com/jeesite/config/web/interceptor/LogInterceptorConfig.java new file mode 100644 index 00000000..c7f791f5 --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/interceptor/LogInterceptorConfig.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web.interceptor; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import com.jeesite.common.config.Global; +import com.jeesite.modules.sys.interceptor.LogInterceptor; + +/** + * 后台管理日志记录拦截器 + * @author ThinkGem + * @version 2018年1月10日 + */ +@Configuration +@EnableWebMvc +@ConditionalOnProperty(name="web.interceptor.log.enabled", havingValue="true", matchIfMissing=true) +public class LogInterceptorConfig extends WebMvcConfigurerAdapter { + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new LogInterceptor()) + .addPathPatterns(Global.getAdminPath() + "/**") + .excludePathPatterns(Global.getAdminPath() + "/index") + .excludePathPatterns(Global.getAdminPath() + "/login") + .excludePathPatterns(Global.getAdminPath() + "/**/listData") + .excludePathPatterns(Global.getAdminPath() + "/**/treeData") + .excludePathPatterns(Global.getAdminPath() + "/file/**") + .excludePathPatterns(Global.getAdminPath() + "/tags/**") + .excludePathPatterns(Global.getAdminPath() + "/sys/log/**") + .excludePathPatterns(Global.getAdminPath() + "/sys/online/count") + ; + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/jeesite/config/web/interceptor/MobileViewInterceptorConfig.java b/web/src/main/java/com/jeesite/config/web/interceptor/MobileViewInterceptorConfig.java new file mode 100644 index 00000000..936b94bf --- /dev/null +++ b/web/src/main/java/com/jeesite/config/web/interceptor/MobileViewInterceptorConfig.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.config.web.interceptor; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import com.jeesite.common.config.Global; +import com.jeesite.modules.sys.interceptor.LogInterceptor; + +/** + * 前台自动切换到手机视图拦截器 + * @author ThinkGem + * @version 2018年1月10日 + */ +@Configuration +@EnableWebMvc +@ConditionalOnProperty(name="web.interceptor.mobile.enabled", havingValue="true") +public class MobileViewInterceptorConfig extends WebMvcConfigurerAdapter { + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new LogInterceptor()) + .addPathPatterns(Global.getFrontPath() + "/**") + ; + } + +} \ No newline at end of file diff --git a/web/src/main/resources/application.yml b/web/src/main/resources/application.yml new file mode 100644 index 00000000..abc6af57 --- /dev/null +++ b/web/src/main/resources/application.yml @@ -0,0 +1,15 @@ + +server: + + port: 8980 + context-path: /js + tomcat: + uri-encoding: UTF-8 + +spring: + main: + banner-mode: "off" + +debug: true + + diff --git a/web/src/main/resources/beetl.properties b/web/src/main/resources/beetl.properties index 8f874ed3..5a9fef83 100644 --- a/web/src/main/resources/beetl.properties +++ b/web/src/main/resources/beetl.properties @@ -2,7 +2,7 @@ #设置与beetl-default.properties相同的属性将被覆盖默认设置 ##导入项目中的调用静态方法类(项目中设置,自动合并IMPORT_PACKAGE设置) -#IMPORT_PACKAGE_你的模块编码=\ +#IMPORT_PACKAGE_PROJECT=\ # com.jeesite.modules.project.utils.;\ ## 内置的方法 diff --git a/web/src/main/resources/jeesite.yml b/web/src/main/resources/jeesite.yml index e1cba23b..431b8947 100644 --- a/web/src/main/resources/jeesite.yml +++ b/web/src/main/resources/jeesite.yml @@ -1,36 +1,36 @@ - -#============================# -#===== Database sttings =====# -#============================# - -# 数据库连接 -jdbc: - - # Oracle 数据库配置 - type: oracle - driver: oracle.jdbc.driver.OracleDriver - url: jdbc:oracle:thin:@127.0.0.1:1521/orcl - username: jeesite - password: jeesite - testSql: SELECT 1 FROM DUAL - - # Mysql 数据库配置 -# type: mysql -# driver: com.mysql.jdbc.Driver -# url: jdbc:mysql://127.0.0.1:3306/jeesite?useUnicode=true&characterEncoding=utf-8 -# username: jeesite -# password: jeesite -# testSql: SELECT 1 - -#============================# -#===== System settings ======# -#============================# - -#产品信息设置 -productName: JeeSite Demo -productVersion: V4.0 -copyrightYear: 2018 -companyName: ThinkGem - -#是否演示模式 -demoMode: false + +#============================# +#===== Database sttings =====# +#============================# + +# 数据库连接 +jdbc: + + # Oracle 数据库配置 + type: oracle + driver: oracle.jdbc.driver.OracleDriver + url: jdbc:oracle:thin:@127.0.0.1:1521/orcl + username: jeesite + password: jeesite + testSql: SELECT 1 FROM DUAL + + # Mysql 数据库配置 +# type: mysql +# driver: com.mysql.jdbc.Driver +# url: jdbc:mysql://127.0.0.1:3306/jeesite?useUnicode=true&characterEncoding=utf-8 +# username: jeesite +# password: jeesite +# testSql: SELECT 1 + +#============================# +#===== System settings ======# +#============================# + +#产品信息设置 +productName: JeeSite Demo +productVersion: V4.0 +copyrightYear: 2018 +companyName: ThinkGem + +#是否演示模式 +demoMode: false diff --git a/web/src/main/resources/logback.xml b/web/src/main/resources/logback.xml index 44c980c8..4bcf3bee 100644 --- a/web/src/main/resources/logback.xml +++ b/web/src/main/resources/logback.xml @@ -3,6 +3,9 @@ + + + diff --git a/web/src/main/resources/spring/spring-context-msg-task.xml b/web/src/main/resources/spring/spring-context-msg-task.xml deleted file mode 100644 index 8a9afa3b..00000000 --- a/web/src/main/resources/spring/spring-context-msg-task.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Message Task Configuration - - - - \ No newline at end of file diff --git a/web/src/main/resources/spring/spring-context.xml b/web/src/main/resources/spring/spring-context.xml deleted file mode 100644 index f8c0b8b9..00000000 --- a/web/src/main/resources/spring/spring-context.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - Spring Configuration - - - - - - - - - - - - com.jeesite.modules - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/web/src/main/resources/spring/spring-mvc.xml b/web/src/main/resources/spring/spring-mvc.xml deleted file mode 100644 index 3cb8c5ae..00000000 --- a/web/src/main/resources/spring/spring-mvc.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Spring MVC Configuration - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/web/src/main/resources/ueditor.json b/web/src/main/resources/ueditor.json index 80eda9e0..6ab8ba7d 100644 --- a/web/src/main/resources/ueditor.json +++ b/web/src/main/resources/ueditor.json @@ -1,94 +1,94 @@ -/* 前后端通信相关的配置,注释只允许使用多行方式,此文件修改及生效,不用重启服务 */ -{ - /* 上传图片配置项 */ - "imageActionName": "uploadimage", /* 执行上传图片的action名称 */ - "imageFieldName": "upfile", /* 提交的图片表单名称 */ - "imageMaxSize": 2048000, /* 上传大小限制,单位B */ - "imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */ - "imageCompressEnable": true, /* 是否压缩图片,默认是true */ - "imageCompressBorder": 800, /* 图片压缩最大宽度限制 */ - "imageInsertAlign": "none", /* 插入的图片浮动方式 */ - "imageUrlPrefix": "", /* 图片访问路径前缀 */ - "imagePathFormat": "/userfiles/ueditor/{userid}/images/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */ - /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */ - /* {time} 会替换成时间戳 */ - /* {yyyy} 会替换成四位年份 */ - /* {yy} 会替换成两位年份 */ - /* {mm} 会替换成两位月份 */ - /* {dd} 会替换成两位日期 */ - /* {hh} 会替换成两位小时 */ - /* {ii} 会替换成两位分钟 */ - /* {ss} 会替换成两位秒 */ - /* 非法字符 \ : * ? " < > | */ - /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */ - - /* 涂鸦图片上传配置项 */ - "scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */ - "scrawlFieldName": "upfile", /* 提交的图片表单名称 */ - "scrawlPathFormat": "/userfiles/ueditor/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - "scrawlMaxSize": 2048000, /* 上传大小限制,单位B */ - "scrawlUrlPrefix": "", /* 图片访问路径前缀 */ - "scrawlInsertAlign": "none", - - /* 截图工具上传 */ - "snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */ - "snapscreenPathFormat": "/userfiles/ueditor/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - "snapscreenUrlPrefix": "", /* 图片访问路径前缀 */ - "snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */ - - /* 抓取远程图片配置 */ - "catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"], - "catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */ - "catcherFieldName": "source", /* 提交的图片列表表单名称 */ - "catcherPathFormat": "/userfiles/ueditor/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - "catcherUrlPrefix": "", /* 图片访问路径前缀 */ - "catcherMaxSize": 2048000, /* 上传大小限制,单位B */ - "catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */ - - /* 上传视频配置 */ - "videoActionName": "uploadvideo", /* 执行上传视频的action名称 */ - "videoFieldName": "upfile", /* 提交的视频表单名称 */ - "videoPathFormat": "/userfiles/ueditor/{userid}/videos/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - "videoUrlPrefix": "", /* 视频访问路径前缀 */ - "videoMaxSize": 102400000, /* 上传大小限制,单位B,默认100MB */ - "videoAllowFiles": [ - ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", - ".ogg", ".ogv", ".mov", ".wmv", ".mp4",".m4v", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */ - - /* 上传文件配置 */ - "fileActionName": "uploadfile", /* controller里,执行上传视频的action名称 */ - "fileFieldName": "upfile", /* 提交的文件表单名称 */ - "filePathFormat": "/userfiles/ueditor/{userid}/files/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ - "fileUrlPrefix": "", /* 文件访问路径前缀 */ - "fileMaxSize": 51200000, /* 上传大小限制,单位B,默认50MB */ - "fileAllowFiles": [ - ".png", ".jpg", ".jpeg", ".gif", ".bmp", - ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", - ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", - ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", - ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" - ], /* 上传文件格式显示 */ - - /* 列出指定目录下的图片 */ - "imageManagerActionName": "listimage", /* 执行图片管理的action名称 */ - "imageManagerListPath": "/userfiles/ueditor/{userid}/images/", /* 指定要列出图片的目录 */ - "imageManagerListSize": 100, /* 每次列出文件数量 */ - "imageManagerUrlPrefix": "", /* 图片访问路径前缀 */ - "imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */ - "imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */ - - /* 列出指定目录下的文件 */ - "fileManagerActionName": "listfile", /* 执行文件管理的action名称 */ - "fileManagerListPath": "/userfiles/ueditor/{userid}/files/", /* 指定要列出文件的目录 */ - "fileManagerListSize": 100, /* 每次列出文件数量 */ - "fileManagerUrlPrefix": "", /* 文件访问路径前缀 */ - "fileManagerAllowFiles": [ - ".png", ".jpg", ".jpeg", ".gif", ".bmp", - ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", - ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", - ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", - ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" - ] /* 列出的文件类型 */ - +/* 前后端通信相关的配置,注释只允许使用多行方式,此文件修改及生效,不用重启服务 */ +{ + /* 上传图片配置项 */ + "imageActionName": "uploadimage", /* 执行上传图片的action名称 */ + "imageFieldName": "upfile", /* 提交的图片表单名称 */ + "imageMaxSize": 2048000, /* 上传大小限制,单位B */ + "imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */ + "imageCompressEnable": true, /* 是否压缩图片,默认是true */ + "imageCompressBorder": 800, /* 图片压缩最大宽度限制 */ + "imageInsertAlign": "none", /* 插入的图片浮动方式 */ + "imageUrlPrefix": "", /* 图片访问路径前缀 */ + "imagePathFormat": "/userfiles/{userid}/images/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */ + /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */ + /* {time} 会替换成时间戳 */ + /* {yyyy} 会替换成四位年份 */ + /* {yy} 会替换成两位年份 */ + /* {mm} 会替换成两位月份 */ + /* {dd} 会替换成两位日期 */ + /* {hh} 会替换成两位小时 */ + /* {ii} 会替换成两位分钟 */ + /* {ss} 会替换成两位秒 */ + /* 非法字符 \ : * ? " < > | */ + /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */ + + /* 涂鸦图片上传配置项 */ + "scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */ + "scrawlFieldName": "upfile", /* 提交的图片表单名称 */ + "scrawlPathFormat": "/userfiles/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "scrawlMaxSize": 2048000, /* 上传大小限制,单位B */ + "scrawlUrlPrefix": "", /* 图片访问路径前缀 */ + "scrawlInsertAlign": "none", + + /* 截图工具上传 */ + "snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */ + "snapscreenPathFormat": "/userfiles/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "snapscreenUrlPrefix": "", /* 图片访问路径前缀 */ + "snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */ + + /* 抓取远程图片配置 */ + "catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"], + "catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */ + "catcherFieldName": "source", /* 提交的图片列表表单名称 */ + "catcherPathFormat": "/userfiles/{userid}/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "catcherUrlPrefix": "", /* 图片访问路径前缀 */ + "catcherMaxSize": 2048000, /* 上传大小限制,单位B */ + "catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */ + + /* 上传视频配置 */ + "videoActionName": "uploadvideo", /* 执行上传视频的action名称 */ + "videoFieldName": "upfile", /* 提交的视频表单名称 */ + "videoPathFormat": "/userfiles/{userid}/videos/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "videoUrlPrefix": "", /* 视频访问路径前缀 */ + "videoMaxSize": 102400000, /* 上传大小限制,单位B,默认100MB */ + "videoAllowFiles": [ + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4",".m4v", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */ + + /* 上传文件配置 */ + "fileActionName": "uploadfile", /* controller里,执行上传视频的action名称 */ + "fileFieldName": "upfile", /* 提交的文件表单名称 */ + "filePathFormat": "/userfiles/{userid}/files/{yyyy}{mm}{dd}/{filename}_${time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */ + "fileUrlPrefix": "", /* 文件访问路径前缀 */ + "fileMaxSize": 51200000, /* 上传大小限制,单位B,默认50MB */ + "fileAllowFiles": [ + ".png", ".jpg", ".jpeg", ".gif", ".bmp", + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", + ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", + ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" + ], /* 上传文件格式显示 */ + + /* 列出指定目录下的图片 */ + "imageManagerActionName": "listimage", /* 执行图片管理的action名称 */ + "imageManagerListPath": "/userfiles/{userid}/images/", /* 指定要列出图片的目录 */ + "imageManagerListSize": 100, /* 每次列出文件数量 */ + "imageManagerUrlPrefix": "", /* 图片访问路径前缀 */ + "imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */ + "imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */ + + /* 列出指定目录下的文件 */ + "fileManagerActionName": "listfile", /* 执行文件管理的action名称 */ + "fileManagerListPath": "/userfiles/{userid}/files/", /* 指定要列出文件的目录 */ + "fileManagerListSize": 100, /* 每次列出文件数量 */ + "fileManagerUrlPrefix": "", /* 文件访问路径前缀 */ + "fileManagerAllowFiles": [ + ".png", ".jpg", ".jpeg", ".gif", ".bmp", + ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", + ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", + ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", + ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" + ] /* 列出的文件类型 */ + } \ No newline at end of file diff --git a/web/src/main/webapp/WEB-INF/web.xml b/web/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 1340b5f3..00000000 --- a/web/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - JeeSite - - - - contextConfigLocation - classpath*:spring/spring-context.xml - - - - - org.springframework.web.context.ContextLoaderListener - - - - - com.jeesite.common.shiro.cas.CasOutSessionListener - - - - - org.springframework.web.context.request.RequestContextListener - - - - - encodingFilter - org.springframework.web.filter.CharacterEncodingFilter - true - - encoding - UTF-8 - - - forceEncoding - true - - - - encodingFilter - /* - - - - - - - shiroFilter - org.springframework.web.filter.DelegatingFilterProxy - true - - targetFilterLifecycle - true - - - - shiroFilter - /* - - - - requestContextFilter - org.springframework.web.filter.RequestContextFilter - true - - - requestContextFilter - /* - - - - - webMvcServlet - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - classpath*:/spring/spring-mvc.xml - - 1 - true - - - webMvcServlet - / - - - - - - - - - - - - - - - 500 - /error/500 - - - 404 - /error/404 - - - \ No newline at end of file diff --git a/web/src/test/java/com/jeesite/test/InitCoreData.java b/web/src/test/java/com/jeesite/test/InitCoreData.java index 05f0f839..2be779a6 100644 --- a/web/src/test/java/com/jeesite/test/InitCoreData.java +++ b/web/src/test/java/com/jeesite/test/InitCoreData.java @@ -4,15 +4,17 @@ package com.jeesite.test; import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Commit; -import org.springframework.test.context.ContextConfiguration; + +import com.jeesite.config.Application; /** * 初始化核心表数据 * @author ThinkGem * @version 2017-10-22 */ -@ContextConfiguration(locations={"classpath*:/spring/spring-context-test.xml"}) +@SpringBootTest(classes=Application.class) @Commit public class InitCoreData extends com.jeesite.modules.db.InitCoreData {