Browse Source

Merge pull request #33 in TC/finekit from ~ZHAOJUNZHE/finekit:master to master

* commit '560e1d63c835d6f9a6d363677389096fedd5cbae':
  update: 根据pr意见进行处理。
  update: 一些补充
remotes/1611766341912730171/master
superman 5 years ago
parent
commit
498dbdc6fd
  1. 14
      src/main/java/com/fanruan/api/design/ui/editor/TextEditor.java
  2. 11
      src/main/java/com/fanruan/api/net/NetworkKit.java
  3. 25
      src/main/java/com/fanruan/api/session/SessionKit.java
  4. 9
      src/main/java/com/fanruan/api/util/ArrayKit.java
  5. 1
      src/main/java/com/fanruan/api/util/RenderKit.java
  6. 9
      src/main/java/com/fanruan/api/xml/XmlKit.java
  7. 4
      src/test/java/com/fanruan/api/net/NetworkKitTest.java

14
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);
}
}

11
src/main/java/com/fanruan/api/net/NetworkKit.java

@ -140,4 +140,15 @@ public class NetworkKit {
public static Locale getLocale(HttpServletRequest req) { public static Locale getLocale(HttpServletRequest req) {
return WebServiceUtils.getLocale(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);
}
} }

25
src/main/java/com/fanruan/api/session/SessionKit.java

@ -1,10 +1,17 @@
package com.fanruan.api.session; package com.fanruan.api.session;
import com.fr.stable.script.NameSpace;
import com.fr.stable.web.SessionProvider; import com.fr.stable.web.SessionProvider;
import com.fr.web.core.ReportSessionIDInfor;
import com.fr.web.core.SessionPoolManager; 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.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/** /**
* @author richie * @author richie
* @version 10.0 * @version 10.0
@ -20,4 +27,22 @@ public class SessionKit {
public static @Nullable SessionProvider getSession(@NotNull String sessionID) { public static @Nullable SessionProvider getSession(@NotNull String sessionID) {
return SessionPoolManager.getSessionIDInfor(sessionID, SessionProvider.class); return SessionPoolManager.getSessionIDInfor(sessionID, SessionProvider.class);
} }
/**
* 生成一个关于回话的用于计算的名字空间
* @param sessionId 会话ID
* @return 名字空间
* */
public static NameSpace asNameSpace(String sessionId) {
return SessionIDInfo.asNameSpace(sessionId);
}
/**
* 将HTTPServletRequest中的所有参数都读取出来,存储在一个Map中,返回出去
* @param req 请求
* @return 参数的map
* */
public static Map<String, Object> parameters4SessionIDInfor(HttpServletRequest req){
return WebUtils.parameters4SessionIDInfor(req);
}
} }

9
src/main/java/com/fanruan/api/util/ArrayKit.java

@ -58,6 +58,15 @@ public class ArrayKit {
public static <T> boolean isEmpty(T[] array) { public static <T> boolean isEmpty(T[] array) {
return ArrayUtils.isEmpty(array); return ArrayUtils.isEmpty(array);
} }
/**
* 判断数组是否为空
*
* @param array 源数组
* @return 返回数组判断为空的结果
*/
public static boolean isEmpty(boolean[] array) {
return ArrayUtils.isEmpty(array);
}
/** /**
* 移除目标数组中对应下标的元素 * 移除目标数组中对应下标的元素
* *

1
src/main/java/com/fanruan/api/util/RenderKit.java

@ -33,5 +33,4 @@ public class RenderKit {
public static String render(String s, Calculator c) throws Exception { public static String render(String s, Calculator c) throws Exception {
return TemplateUtils.render(s, c); return TemplateUtils.render(s, c);
} }
} }

9
src/main/java/com/fanruan/api/xml/XmlKit.java

@ -104,4 +104,13 @@ public class XmlKit {
public static void writeParameters(XMLPrintWriter writer, ParameterProvider[] parameter) { public static void writeParameters(XMLPrintWriter writer, ParameterProvider[] parameter) {
StableXMLUtils.writeParameters(writer,parameter); StableXMLUtils.writeParameters(writer,parameter);
} }
/**
* 以xml方式读string
* @param xmlString xml字符串
* @return xml文件
* */
public static XMLReadable readStringAsXMLable(String xmlString) {
return GeneralXMLTools.readStringAsXMLable(xmlString);
}
} }

4
src/test/java/com/fanruan/api/net/NetworkKitTest.java

@ -48,4 +48,8 @@ public class NetworkKitTest extends Prepare {
@Test @Test
public void testGetHTTPRequestParameter() { public void testGetHTTPRequestParameter() {
} }
@Test
public void getHTTPRequestEncodeParameter() {
}
} }
Loading…
Cancel
Save