diff --git a/common/src/main/java/com/jeesite/common/io/ResourceUtils.java b/common/src/main/java/com/jeesite/common/io/ResourceUtils.java index 0ea84dc7..0abc0b12 100644 --- a/common/src/main/java/com/jeesite/common/io/ResourceUtils.java +++ b/common/src/main/java/com/jeesite/common/io/ResourceUtils.java @@ -1,74 +1,89 @@ -/** - * Copyright (c) 2013-Now http://jeesite.com All rights reserved. - */ -package com.jeesite.common.io; - -import java.io.IOException; -import java.io.InputStream; - -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; - -import com.jeesite.common.lang.ExceptionUtils; - -/** - * 资源供给类 - * @author ThinkGem - * @version 2016-9-16 - */ -public class ResourceUtils extends org.springframework.util.ResourceUtils { - - private static ResourceLoader resourceLoader = new DefaultResourceLoader(); - - /** - * 获取ClassLoader - */ - public static ClassLoader getClassLoader() { - return resourceLoader.getClassLoader(); - } - - /** - * 获取资源加载器(可读取jar内的文件) - */ - public static Resource getResource(String location) { - return resourceLoader.getResource(location); - } - - /** - * 获取资源文件流(用后记得关闭) - * @param location - * @author ThinkGem - * @throws IOException - */ - public static InputStream getResourceFileStream(String location) throws IOException{ - Resource resource = resourceLoader.getResource(location); - return resource.getInputStream(); - } - - /** - * 获取资源文件内容 - * @param location - * @author ThinkGem - */ - public static String getResourceFileContent(String location){ - InputStream is = null; - try{ - is = ResourceUtils.getResourceFileStream(location); - return IOUtils.toString(is, "UTF-8"); - }catch (IOException e) { - throw ExceptionUtils.unchecked(e); - }finally{ - IOUtils.closeQuietly(is); - } - } - - /** - * 获取资源加载器(可读取jar内的文件) - * @author ThinkGem - */ - public static ResourceLoader getResourceLoader() { - return resourceLoader; - } - -} +/** + * Copyright (c) 2013-Now http://jeesite.com All rights reserved. + */ +package com.jeesite.common.io; + +import java.io.IOException; +import java.io.InputStream; + +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; + +import com.jeesite.common.lang.ExceptionUtils; + +/** + * 资源供给类 + * @author ThinkGem + * @version 2016-9-16 + */ +public class ResourceUtils extends org.springframework.util.ResourceUtils { + + private static ResourceLoader resourceLoader = new DefaultResourceLoader(); + + /** + * 获取资源加载器(可读取jar内的文件) + * @author ThinkGem + */ + public static ResourceLoader getResourceLoader() { + return resourceLoader; + } + + /** + * 获取ClassLoader + */ + public static ClassLoader getClassLoader() { + return resourceLoader.getClassLoader(); + } + + /** + * 获取资源加载器(可读取jar内的文件) + */ + public static Resource getResource(String location) { + return resourceLoader.getResource(location); + } + + /** + * 获取资源文件流(用后记得关闭) + * @param location + * @author ThinkGem + * @throws IOException + */ + public static InputStream getResourceFileStream(String location) throws IOException{ + Resource resource = resourceLoader.getResource(location); + return resource.getInputStream(); + } + + /** + * 获取资源文件内容 + * @param location + * @author ThinkGem + */ + public static String getResourceFileContent(String location){ + InputStream is = null; + try{ + is = ResourceUtils.getResourceFileStream(location); + return IOUtils.toString(is, "UTF-8"); + }catch (IOException e) { + throw ExceptionUtils.unchecked(e); + }finally{ + IOUtils.closeQuietly(is); + } + } + + /** + * Spring 搜索资源文件 + * @param locationPattern + * @author ThinkGem + */ + public static Resource[] getResources(String locationPattern){ + try { + return new PathMatchingResourcePatternResolver() + .getResources(locationPattern); + } catch (IOException e) { + throw ExceptionUtils.unchecked(e); + } + } + +} diff --git a/modules/core/src/main/resources/beetl-core.properties b/modules/core/src/main/resources/beetl-core.properties index 42a1285b..2d6c807c 100644 --- a/modules/core/src/main/resources/beetl-core.properties +++ b/modules/core/src/main/resources/beetl-core.properties @@ -1,138 +1,138 @@ - -#######默认配置(/org/beetl/core/beetl-default.properties) -ENGINE=org.beetl.core.engine.FastRuntimeEngine -DELIMITER_PLACEHOLDER_START=${ -DELIMITER_PLACEHOLDER_END=} -DELIMITER_STATEMENT_START=<% -DELIMITER_STATEMENT_END=%> -DIRECT_BYTE_OUTPUT = FALSE -HTML_TAG_SUPPORT = true -HTML_TAG_FLAG = # -HTML_TAG_BINDING_ATTRIBUTE = var -NATIVE_CALL = TRUE -TEMPLATE_CHARSET = UTF-8 -#ERROR_HANDLER = org.beetl.core.ConsoleErrorHandler -ERROR_HANDLER = com.jeesite.common.beetl.handler.LoggerErrorHandler -NATIVE_SECUARTY_MANAGER = org.beetl.core.DefaultNativeSecurityManager -RESOURCE_LOADER = org.beetl.core.resource.ClasspathResourceLoader -MVC_STRICT = FALSE - -#导入调用静态方法类 -IMPORT_PACKAGE= - -##导入JeeSite调用静态方法类(自动合并IMPORT_PACKAGE设置) -IMPORT_PACKAGE_JeeSite=\ - com.jeesite.common.config.;\ - com.jeesite.common.codec.;\ - com.jeesite.common.collect.;\ - com.jeesite.common.idgen.;\ - com.jeesite.common.lang.;\ - com.jeesite.common.mapper.;\ - com.jeesite.common.reflect.;\ - com.jeesite.common.security.;\ - com.jeesite.common.web.http.;\ - com.jeesite.modules.sys.utils.;\ - -### 资源配置,resource后的属性只限于特定ResourceLoader #### -#classpath 跟路径 -RESOURCE.root = views -#是否检测文件变化 -RESOURCE.autoCheck = TRUE -#自定义脚本方法文件位置 -RESOURCE.functionRoot = functions -#自定义脚本方法文件的后缀 -RESOURCE.functionSuffix = html -#自定义标签文件位置 -RESOURCE.tagRoot = htmltags -#自定义标签文件后缀 -RESOURCE.tagSuffix = html - -#如果采用beetl集成的web应用,可以在渲染模板前调用如下类,此类必须实现WebRenderExt接口 -WEBAPP_EXT = - -#允许html function or Tag 使用特殊的定界符 -FUNCTION_TAG_LIMITER= - -##### 扩展 ############## -## 内置的方法 -FN.date = org.beetl.ext.fn.DateFunction -FN.nvl = org.beetl.ext.fn.NVLFunction -FN.debug = org.beetl.ext.fn.DebugFunction -#兼容以前版本,用has代替 -FN.exist = org.beetl.ext.fn.CheckExistFunction -FN.has = org.beetl.ext.fn.CheckExistFunction -FN.printf = org.beetl.ext.fn.Printf -FN.decode = org.beetl.ext.fn.DecodeFunction -FN.assert = org.beetl.ext.fn.AssertFunction -FN.print = org.beetl.ext.fn.Print -FN.println = org.beetl.ext.fn.Println -FN.trunc = org.beetl.ext.fn.TruncFunction -#兼容以前版本 empty,用isEmpty代替 -FN.empty = org.beetl.ext.fn.EmptyFunction -FN.qmark = org.beetl.ext.fn.QuestionMark -FN.isEmpty = org.beetl.ext.fn.EmptyExpressionFunction -FN.isNotEmpty = org.beetl.ext.fn.IsNotEmptyExpressionFunction -FN.parseInt = org.beetl.ext.fn.ParseInt -FN.parseLong = org.beetl.ext.fn.ParseLong -FN.parseDouble= org.beetl.ext.fn.ParseDouble -FN.range = org.beetl.ext.fn.Range -FN.flush = org.beetl.ext.fn.Flush -FN.json = org.beetl.ext.fn.Json -FN.pageCtx = org.beetl.ext.fn.PageContextFunction -FN.type.new=org.beetl.ext.fn.TypeNewFunction -FN.type.name=org.beetl.ext.fn.TypeNameFunction -FN.global=org.beetl.ext.fn.DynamicGlobalValueFunction - -##内置的功能包 -FNP.strutil = org.beetl.ext.fn.StringUtil -FNP.reg = org.beetl.ext.fn.RegxFunctionUtil - -FNP.array = org.beetl.ext.fn.ArrayUtil - -##内置的格式化函数 -FT.dateFormat = org.beetl.ext.format.DateFormat -FT.numberFormat = org.beetl.ext.format.NumberFormat - -##内置的默认格式化函数 -FTC.java.util.Date = org.beetl.ext.format.DateFormat -FTC.java.sql.Date = org.beetl.ext.format.DateFormat -FTC.java.sql.Time = org.beetl.ext.format.DateFormat -FTC.java.sql.Timestamp = org.beetl.ext.format.DateFormat -FTC.java.lang.Short = org.beetl.ext.format.NumberFormat -FTC.java.lang.Long = org.beetl.ext.format.NumberFormat -FTC.java.lang.Integer = org.beetl.ext.format.NumberFormat -FTC.java.lang.Float = org.beetl.ext.format.NumberFormat -FTC.java.lang.Double = org.beetl.ext.format.NumberFormat -FTC.java.math.BigInteger = org.beetl.ext.format.NumberFormat -FTC.java.math.BigDecimal = org.beetl.ext.format.NumberFormat -FTC.java.util.concurrent.atomic.AtomicLong = org.beetl.ext.format.NumberFormat -FTC.java.util.concurrent.atomic.AtomicInteger = org.beetl.ext.format.NumberFormat - -##虚拟属性 无 -## 标签类 -TAG.include= org.beetl.ext.tag.IncludeTag -TAG.includeFileTemplate= org.beetl.ext.tag.IncludeTag -TAG.incdlueJSP= org.beetl.ext.jsp.IncludeJSPTag -TAG.layout= org.beetl.ext.tag.LayoutTag -TAG.delete= org.beetl.ext.tag.DeleteTag -#TAG.htmltag= org.beetl.ext.tag.HTMLTagSupportWrapper -#TAG.htmltagvar= org.beetl.ext.tag.HTMLTagVarBindingWrapper -TAG.htmltag= com.jeesite.common.beetl.ext.tag.HTMLTag -TAG.htmltagvar= com.jeesite.common.beetl.ext.tag.HTMLTagVar -TAG.cache= org.beetl.ext.tag.cache.CacheTag - -##JeeSite自定义函数 -FN.isBlank = com.jeesite.common.beetl.ext.fn.IsBlank -FN.isNotBlank = com.jeesite.common.beetl.ext.fn.IsNotBlank -FN.toJson = com.jeesite.common.beetl.ext.fn.ToJson -FN.fromJson = com.jeesite.common.beetl.ext.fn.FromJson -FN.hasPermi = com.jeesite.common.beetl.ext.fn.HasPermi -FN.cookie = com.jeesite.common.beetl.ext.fn.Cookie -FN.lang = com.jeesite.common.beetl.ext.fn.Lang -FN.text = com.jeesite.common.beetl.ext.fn.Text - -##JeeSite内置的功能包 -#FNP.StringUtils = com.jeesite.common.lang.StringUtils -#FNP.NumberUtils = com.jeesite.common.lang.NumberUtils -#FNP.DateUtils = com.jeesite.common.lang.DateUtils -#FNP.TimeUtils = com.jeesite.common.lang.TimeUtils + +#######默认配置(/org/beetl/core/beetl-default.properties) +ENGINE=org.beetl.core.engine.FastRuntimeEngine +DELIMITER_PLACEHOLDER_START=${ +DELIMITER_PLACEHOLDER_END=} +DELIMITER_STATEMENT_START=<% +DELIMITER_STATEMENT_END=%> +DIRECT_BYTE_OUTPUT = FALSE +HTML_TAG_SUPPORT = true +HTML_TAG_FLAG = # +HTML_TAG_BINDING_ATTRIBUTE = var +NATIVE_CALL = TRUE +TEMPLATE_CHARSET = UTF-8 +#ERROR_HANDLER = org.beetl.core.ConsoleErrorHandler +ERROR_HANDLER = com.jeesite.common.beetl.handler.LoggerErrorHandler +NATIVE_SECUARTY_MANAGER = org.beetl.core.DefaultNativeSecurityManager +RESOURCE_LOADER = org.beetl.core.resource.ClasspathResourceLoader +MVC_STRICT = FALSE + +#导入调用静态方法类 +IMPORT_PACKAGE= + +##导入JeeSite调用静态方法类(自动合并IMPORT_PACKAGE设置) +IMPORT_PACKAGE_core=\ + com.jeesite.common.config.;\ + com.jeesite.common.codec.;\ + com.jeesite.common.collect.;\ + com.jeesite.common.idgen.;\ + com.jeesite.common.lang.;\ + com.jeesite.common.mapper.;\ + com.jeesite.common.reflect.;\ + com.jeesite.common.security.;\ + com.jeesite.common.web.http.;\ + com.jeesite.modules.sys.utils.;\ + +### 资源配置,resource后的属性只限于特定ResourceLoader #### +#classpath 跟路径 +RESOURCE.root = views +#是否检测文件变化 +RESOURCE.autoCheck = TRUE +#自定义脚本方法文件位置 +RESOURCE.functionRoot = functions +#自定义脚本方法文件的后缀 +RESOURCE.functionSuffix = html +#自定义标签文件位置 +RESOURCE.tagRoot = htmltags +#自定义标签文件后缀 +RESOURCE.tagSuffix = html + +#如果采用beetl集成的web应用,可以在渲染模板前调用如下类,此类必须实现WebRenderExt接口 +WEBAPP_EXT = + +#允许html function or Tag 使用特殊的定界符 +FUNCTION_TAG_LIMITER= + +##### 扩展 ############## +## 内置的方法 +FN.date = org.beetl.ext.fn.DateFunction +FN.nvl = org.beetl.ext.fn.NVLFunction +FN.debug = org.beetl.ext.fn.DebugFunction +#兼容以前版本,用has代替 +FN.exist = org.beetl.ext.fn.CheckExistFunction +FN.has = org.beetl.ext.fn.CheckExistFunction +FN.printf = org.beetl.ext.fn.Printf +FN.decode = org.beetl.ext.fn.DecodeFunction +FN.assert = org.beetl.ext.fn.AssertFunction +FN.print = org.beetl.ext.fn.Print +FN.println = org.beetl.ext.fn.Println +FN.trunc = org.beetl.ext.fn.TruncFunction +#兼容以前版本 empty,用isEmpty代替 +FN.empty = org.beetl.ext.fn.EmptyFunction +FN.qmark = org.beetl.ext.fn.QuestionMark +FN.isEmpty = org.beetl.ext.fn.EmptyExpressionFunction +FN.isNotEmpty = org.beetl.ext.fn.IsNotEmptyExpressionFunction +FN.parseInt = org.beetl.ext.fn.ParseInt +FN.parseLong = org.beetl.ext.fn.ParseLong +FN.parseDouble= org.beetl.ext.fn.ParseDouble +FN.range = org.beetl.ext.fn.Range +FN.flush = org.beetl.ext.fn.Flush +FN.json = org.beetl.ext.fn.Json +FN.pageCtx = org.beetl.ext.fn.PageContextFunction +FN.type.new=org.beetl.ext.fn.TypeNewFunction +FN.type.name=org.beetl.ext.fn.TypeNameFunction +FN.global=org.beetl.ext.fn.DynamicGlobalValueFunction + +##内置的功能包 +FNP.strutil = org.beetl.ext.fn.StringUtil +FNP.reg = org.beetl.ext.fn.RegxFunctionUtil + +FNP.array = org.beetl.ext.fn.ArrayUtil + +##内置的格式化函数 +FT.dateFormat = org.beetl.ext.format.DateFormat +FT.numberFormat = org.beetl.ext.format.NumberFormat + +##内置的默认格式化函数 +FTC.java.util.Date = org.beetl.ext.format.DateFormat +FTC.java.sql.Date = org.beetl.ext.format.DateFormat +FTC.java.sql.Time = org.beetl.ext.format.DateFormat +FTC.java.sql.Timestamp = org.beetl.ext.format.DateFormat +FTC.java.lang.Short = org.beetl.ext.format.NumberFormat +FTC.java.lang.Long = org.beetl.ext.format.NumberFormat +FTC.java.lang.Integer = org.beetl.ext.format.NumberFormat +FTC.java.lang.Float = org.beetl.ext.format.NumberFormat +FTC.java.lang.Double = org.beetl.ext.format.NumberFormat +FTC.java.math.BigInteger = org.beetl.ext.format.NumberFormat +FTC.java.math.BigDecimal = org.beetl.ext.format.NumberFormat +FTC.java.util.concurrent.atomic.AtomicLong = org.beetl.ext.format.NumberFormat +FTC.java.util.concurrent.atomic.AtomicInteger = org.beetl.ext.format.NumberFormat + +##虚拟属性 无 +## 标签类 +TAG.include= org.beetl.ext.tag.IncludeTag +TAG.includeFileTemplate= org.beetl.ext.tag.IncludeTag +TAG.incdlueJSP= org.beetl.ext.jsp.IncludeJSPTag +TAG.layout= org.beetl.ext.tag.LayoutTag +TAG.delete= org.beetl.ext.tag.DeleteTag +#TAG.htmltag= org.beetl.ext.tag.HTMLTagSupportWrapper +#TAG.htmltagvar= org.beetl.ext.tag.HTMLTagVarBindingWrapper +TAG.htmltag= com.jeesite.common.beetl.ext.tag.HTMLTag +TAG.htmltagvar= com.jeesite.common.beetl.ext.tag.HTMLTagVar +TAG.cache= org.beetl.ext.tag.cache.CacheTag + +##JeeSite自定义函数 +FN.isBlank = com.jeesite.common.beetl.ext.fn.IsBlank +FN.isNotBlank = com.jeesite.common.beetl.ext.fn.IsNotBlank +FN.toJson = com.jeesite.common.beetl.ext.fn.ToJson +FN.fromJson = com.jeesite.common.beetl.ext.fn.FromJson +FN.hasPermi = com.jeesite.common.beetl.ext.fn.HasPermi +FN.cookie = com.jeesite.common.beetl.ext.fn.Cookie +FN.lang = com.jeesite.common.beetl.ext.fn.Lang +FN.text = com.jeesite.common.beetl.ext.fn.Text + +##JeeSite内置的功能包 +#FNP.StringUtils = com.jeesite.common.lang.StringUtils +#FNP.NumberUtils = com.jeesite.common.lang.NumberUtils +#FNP.DateUtils = com.jeesite.common.lang.DateUtils +#FNP.TimeUtils = com.jeesite.common.lang.TimeUtils diff --git a/web/src/main/resources/beetl.properties b/web/src/main/resources/beetl.properties index 02b347f4..8f874ed3 100644 --- a/web/src/main/resources/beetl.properties +++ b/web/src/main/resources/beetl.properties @@ -1,21 +1,21 @@ - -#设置与beetl-default.properties相同的属性将被覆盖默认设置 - -##导入项目中的调用静态方法类(项目中设置,自动合并IMPORT_PACKAGE设置) -#IMPORT_PACKAGE_PROJECT=\ -# com.jeesite.modules.project.utils.;\ - -## 内置的方法 -#FN.date = org.beetl.ext.fn.DateFunction - -##内置的功能包 -#FNP.strutil = org.beetl.ext.fn.StringUtil - -##内置的格式化函数 -#FT.dateFormat = org.beetl.ext.format.DateFormat - -##内置的默认格式化函数 -#FTC.java.util.Date = org.beetl.ext.format.DateFormat - -## 标签类 -#TAG.include= org.beetl.ext.tag.IncludeTag + +#设置与beetl-default.properties相同的属性将被覆盖默认设置 + +##导入项目中的调用静态方法类(项目中设置,自动合并IMPORT_PACKAGE设置) +#IMPORT_PACKAGE_你的模块编码=\ +# com.jeesite.modules.project.utils.;\ + +## 内置的方法 +#FN.date = org.beetl.ext.fn.DateFunction + +##内置的功能包 +#FNP.strutil = org.beetl.ext.fn.StringUtil + +##内置的格式化函数 +#FT.dateFormat = org.beetl.ext.format.DateFormat + +##内置的默认格式化函数 +#FTC.java.util.Date = org.beetl.ext.format.DateFormat + +## 标签类 +#TAG.include= org.beetl.ext.tag.IncludeTag diff --git a/web/src/test/java/com/jeesite/test/Test.java b/web/src/test/java/com/jeesite/test/Test.java index 08ea063e..9abcb8b9 100644 --- a/web/src/test/java/com/jeesite/test/Test.java +++ b/web/src/test/java/com/jeesite/test/Test.java @@ -1,9 +1,9 @@ -package com.jeesite.test; - -public class Test { - - public static void main(String[] args) { - - } - -} +package com.jeesite.test; + +public class Test { + + public static void main(String[] args) { + + } + +}