From cc61a9c157bb290e751e98ad642871c8504e88a5 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Tue, 24 Sep 2019 18:25:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update:=20=E4=B8=80=E4=BA=9B=E8=A1=A5?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/container/NameObjectCreator.java | 19 +++++++++++++++++++ .../api/design/ui/editor/TextEditor.java | 14 ++++++++++++++ .../java/com/fanruan/api/net/NetworkKit.java | 11 +++++++++++ .../com/fanruan/api/session/SessionKit.java | 12 ++++++++++++ .../java/com/fanruan/api/util/RenderKit.java | 9 +++++++++ src/main/java/com/fanruan/api/web/WebKit.java | 17 +++++++++++++++++ src/main/java/com/fanruan/api/xml/XmlKit.java | 9 +++++++++ .../com/fanruan/api/net/NetworkKitTest.java | 4 ++++ 8 files changed, 95 insertions(+) create mode 100644 src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java create mode 100644 src/main/java/com/fanruan/api/design/ui/editor/TextEditor.java create mode 100644 src/main/java/com/fanruan/api/web/WebKit.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java b/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java new file mode 100644 index 0000000..3145797 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java @@ -0,0 +1,19 @@ +package com.fanruan.api.design.ui.container; + +import com.fr.design.beans.BasicBeanPane; + +/** + * 创建一个名称空间对象 + * */ +public class NameObjectCreator extends com.fr.design.gui.controlpane.NameObjectCreator{ + public NameObjectCreator(String menuName, Class clazz, Class updatePane) { + super(menuName, clazz, updatePane); + } + public NameObjectCreator(String menuName, String iconPath, Class clazz) { + super(menuName, iconPath, clazz); + } + + public NameObjectCreator(String menuName, String iconPath, Class clazz, Class updatePane) { + super(menuName, iconPath, clazz, updatePane); + } +} diff --git a/src/main/java/com/fanruan/api/design/ui/editor/TextEditor.java b/src/main/java/com/fanruan/api/design/ui/editor/TextEditor.java new file mode 100644 index 0000000..4a08298 --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/editor/TextEditor.java @@ -0,0 +1,14 @@ +package com.fanruan.api.design.ui.editor; + +/** + * 文本编辑器 + * */ +public class TextEditor extends com.fr.design.editor.editor.TextEditor{ + public TextEditor(){ + + } + + public TextEditor(String value) { + super(value); + } +} diff --git a/src/main/java/com/fanruan/api/net/NetworkKit.java b/src/main/java/com/fanruan/api/net/NetworkKit.java index e697b37..e7d859c 100644 --- a/src/main/java/com/fanruan/api/net/NetworkKit.java +++ b/src/main/java/com/fanruan/api/net/NetworkKit.java @@ -140,4 +140,15 @@ public class NetworkKit { public static Locale getLocale(HttpServletRequest req) { return WebServiceUtils.getLocale(req); } + + /** + *获取HTTP请求中指定名字的参数值 + * @param req 请求 + * @param encode 是否编码 + * @param paraName 参数名 + * @return 参数值 + * */ + public static String getHTTPRequestEncodeParameter(HttpServletRequest req, String paraName, boolean encode) { + return NetworkHelper.getHTTPRequestEncodeParameter(req, paraName, encode); + } } diff --git a/src/main/java/com/fanruan/api/session/SessionKit.java b/src/main/java/com/fanruan/api/session/SessionKit.java index 55c00bc..83b8381 100644 --- a/src/main/java/com/fanruan/api/session/SessionKit.java +++ b/src/main/java/com/fanruan/api/session/SessionKit.java @@ -1,7 +1,10 @@ package com.fanruan.api.session; +import com.fr.stable.script.NameSpace; import com.fr.stable.web.SessionProvider; +import com.fr.web.core.ReportSessionIDInfor; import com.fr.web.core.SessionPoolManager; +import com.fr.web.session.SessionIDInfo; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -20,4 +23,13 @@ public class SessionKit { public static @Nullable SessionProvider getSession(@NotNull String sessionID) { return SessionPoolManager.getSessionIDInfor(sessionID, SessionProvider.class); } + + /** + * 生成一个关于回话的用于计算的名字空间 + * @param sessionId 会话ID + * @return 名字空间 + * */ + public static NameSpace asNameSpace(String sessionId) { + return SessionIDInfo.asNameSpace(sessionId); + } } diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index bd5d003..ad40f2e 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -33,5 +33,14 @@ public class RenderKit { public static String render(String s, Calculator c) throws Exception { return TemplateUtils.render(s, c); } + /** + * 根据参数, 来计算文档字符串 + * @param string 待渲染的文本模板 + * @return 返回渲染后的文本 + * @throws Exception 渲染过程中出现错误则抛出此异常 + */ + public static String render(String string) throws Exception { + return TemplateUtils.render(string); + } } diff --git a/src/main/java/com/fanruan/api/web/WebKit.java b/src/main/java/com/fanruan/api/web/WebKit.java new file mode 100644 index 0000000..8d2823a --- /dev/null +++ b/src/main/java/com/fanruan/api/web/WebKit.java @@ -0,0 +1,17 @@ +package com.fanruan.api.web; + +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +public class WebKit { + /** + * 将HTTPServletRequest中的所有参数都读取出来,存储在一个Map中,返回出去 + * @param req 请求 + * @return 参数的map + * */ + public static Map parameters4SessionIDInfor(HttpServletRequest req){ + return WebUtils.parameters4SessionIDInfor(req); + } +} diff --git a/src/main/java/com/fanruan/api/xml/XmlKit.java b/src/main/java/com/fanruan/api/xml/XmlKit.java index 6639bc2..e69c136 100644 --- a/src/main/java/com/fanruan/api/xml/XmlKit.java +++ b/src/main/java/com/fanruan/api/xml/XmlKit.java @@ -104,4 +104,13 @@ public class XmlKit { public static void writeParameters(XMLPrintWriter writer, ParameterProvider[] parameter) { StableXMLUtils.writeParameters(writer,parameter); } + + /** + * 以xml方式读string + * @param xmlString xml字符串 + * @return xml文件 + * */ + public static XMLReadable readStringAsXMLable(String xmlString) { + return GeneralXMLTools.readStringAsXMLable(xmlString); + } } diff --git a/src/test/java/com/fanruan/api/net/NetworkKitTest.java b/src/test/java/com/fanruan/api/net/NetworkKitTest.java index b8c5328..3205c6e 100644 --- a/src/test/java/com/fanruan/api/net/NetworkKitTest.java +++ b/src/test/java/com/fanruan/api/net/NetworkKitTest.java @@ -48,4 +48,8 @@ public class NetworkKitTest extends Prepare { @Test public void testGetHTTPRequestParameter() { } + + @Test + public void getHTTPRequestEncodeParameter() { + } } \ No newline at end of file From 560e1d63c835d6f9a6d363677389096fedd5cbae Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Tue, 24 Sep 2019 19:28:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?update:=20=E6=A0=B9=E6=8D=AEpr=E6=84=8F?= =?UTF-8?q?=E8=A7=81=E8=BF=9B=E8=A1=8C=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/container/NameObjectCreator.java | 19 ------------------- .../com/fanruan/api/session/SessionKit.java | 13 +++++++++++++ .../java/com/fanruan/api/util/ArrayKit.java | 9 +++++++++ .../java/com/fanruan/api/util/RenderKit.java | 10 ---------- src/main/java/com/fanruan/api/web/WebKit.java | 17 ----------------- 5 files changed, 22 insertions(+), 46 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java delete mode 100644 src/main/java/com/fanruan/api/web/WebKit.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java b/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java deleted file mode 100644 index 3145797..0000000 --- a/src/main/java/com/fanruan/api/design/ui/container/NameObjectCreator.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fanruan.api.design.ui.container; - -import com.fr.design.beans.BasicBeanPane; - -/** - * 创建一个名称空间对象 - * */ -public class NameObjectCreator extends com.fr.design.gui.controlpane.NameObjectCreator{ - public NameObjectCreator(String menuName, Class clazz, Class updatePane) { - super(menuName, clazz, updatePane); - } - public NameObjectCreator(String menuName, String iconPath, Class clazz) { - super(menuName, iconPath, clazz); - } - - public NameObjectCreator(String menuName, String iconPath, Class clazz, Class updatePane) { - super(menuName, iconPath, clazz, updatePane); - } -} diff --git a/src/main/java/com/fanruan/api/session/SessionKit.java b/src/main/java/com/fanruan/api/session/SessionKit.java index 83b8381..9f0091c 100644 --- a/src/main/java/com/fanruan/api/session/SessionKit.java +++ b/src/main/java/com/fanruan/api/session/SessionKit.java @@ -5,9 +5,13 @@ import com.fr.stable.web.SessionProvider; import com.fr.web.core.ReportSessionIDInfor; import com.fr.web.core.SessionPoolManager; import com.fr.web.session.SessionIDInfo; +import com.fr.web.utils.WebUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + /** * @author richie * @version 10.0 @@ -32,4 +36,13 @@ public class SessionKit { public static NameSpace asNameSpace(String sessionId) { return SessionIDInfo.asNameSpace(sessionId); } + + /** + * 将HTTPServletRequest中的所有参数都读取出来,存储在一个Map中,返回出去 + * @param req 请求 + * @return 参数的map + * */ + public static Map parameters4SessionIDInfor(HttpServletRequest req){ + return WebUtils.parameters4SessionIDInfor(req); + } } diff --git a/src/main/java/com/fanruan/api/util/ArrayKit.java b/src/main/java/com/fanruan/api/util/ArrayKit.java index ed5b319..ac62c64 100644 --- a/src/main/java/com/fanruan/api/util/ArrayKit.java +++ b/src/main/java/com/fanruan/api/util/ArrayKit.java @@ -58,6 +58,15 @@ public class ArrayKit { public static boolean isEmpty(T[] array) { return ArrayUtils.isEmpty(array); } + /** + * 判断数组是否为空 + * + * @param array 源数组 + * @return 返回数组判断为空的结果 + */ + public static boolean isEmpty(boolean[] array) { + return ArrayUtils.isEmpty(array); + } /** * 移除目标数组中对应下标的元素 * diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index ad40f2e..65d27f7 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -33,14 +33,4 @@ public class RenderKit { public static String render(String s, Calculator c) throws Exception { return TemplateUtils.render(s, c); } - /** - * 根据参数, 来计算文档字符串 - * @param string 待渲染的文本模板 - * @return 返回渲染后的文本 - * @throws Exception 渲染过程中出现错误则抛出此异常 - */ - public static String render(String string) throws Exception { - return TemplateUtils.render(string); - } - } diff --git a/src/main/java/com/fanruan/api/web/WebKit.java b/src/main/java/com/fanruan/api/web/WebKit.java deleted file mode 100644 index 8d2823a..0000000 --- a/src/main/java/com/fanruan/api/web/WebKit.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fanruan.api.web; - -import com.fr.web.utils.WebUtils; - -import javax.servlet.http.HttpServletRequest; -import java.util.Map; - -public class WebKit { - /** - * 将HTTPServletRequest中的所有参数都读取出来,存储在一个Map中,返回出去 - * @param req 请求 - * @return 参数的map - * */ - public static Map parameters4SessionIDInfor(HttpServletRequest req){ - return WebUtils.parameters4SessionIDInfor(req); - } -}