diff --git a/.gitignore b/.gitignore index a45cc0ad87a9d907f5e853ea09ad6897294e8973..e7df3e95b085308bbdfa1ab0861f2a4cb8d6a331 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,8 @@ out/ .project .settings bin/ -.myeclipse \ No newline at end of file +.myeclipse +application-local.properties +# jrebel +rebel.xml +.rebel.xml.bak \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5e73559d9b562d9273d89f37bb23a2281a3d2238..5375958df0f220c9717f0369995d6e44027dc733 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.spiderflow spider-flow - 0.5.0 + 0.5.1-SNAPSHOT pom spider-flow https://gitee.com/jmxd/spider-flow @@ -177,4 +177,36 @@ spider-flow-core spider-flow-web + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + org.codehaus.mojo + versions-maven-plugin + + false + + + + diff --git a/spider-flow-api/pom.xml b/spider-flow-api/pom.xml index 9fcab72d4691a56b3fdeb3b2096dc8db1ef21802..6db2caadce2356c02922dc2a11915d3e96fa4b84 100644 --- a/spider-flow-api/pom.xml +++ b/spider-flow-api/pom.xml @@ -4,7 +4,7 @@ org.spiderflow spider-flow - 0.5.0 + 0.5.1-SNAPSHOT spider-flow-api spider-flow-api @@ -12,4 +12,22 @@ UTF-8 + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + diff --git a/spider-flow-core/pom.xml b/spider-flow-core/pom.xml index 4bd8a4b209244856a4e472389b3c40e5326018ac..bfe94949c8caba0e7753aad40bcfd626341b3e08 100644 --- a/spider-flow-core/pom.xml +++ b/spider-flow-core/pom.xml @@ -4,7 +4,7 @@ org.spiderflow spider-flow - 0.5.0 + 0.5.1-SNAPSHOT spider-flow-core spider-flow-core @@ -18,4 +18,22 @@ spider-flow-api + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + diff --git a/spider-flow-core/src/main/java/org/spiderflow/core/executor/function/UrlFunctionExecutor.java b/spider-flow-core/src/main/java/org/spiderflow/core/executor/function/UrlFunctionExecutor.java index 48da2073ea144acfcdfb79d78eea55b658d522f0..d3bf108cbfc66811aa97b51dc90ae6e8840b9294 100644 --- a/spider-flow-core/src/main/java/org/spiderflow/core/executor/function/UrlFunctionExecutor.java +++ b/spider-flow-core/src/main/java/org/spiderflow/core/executor/function/UrlFunctionExecutor.java @@ -1,6 +1,8 @@ package org.spiderflow.core.executor.function; import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.Charset; @@ -10,6 +12,7 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.spiderflow.annotation.Comment; import org.spiderflow.annotation.Example; +import org.spiderflow.annotation.Return; import org.spiderflow.executor.FunctionExecutor; import org.springframework.stereotype.Component; @@ -92,4 +95,23 @@ public class UrlFunctionExecutor implements FunctionExecutor{ return null; } } + + @Comment("url相对地址转绝对地址") + @Example("${url.absolute('http://www.example.com/abc/index.html','./abs.html')}") + @Return({String.class}) + public static String absolute(String baseUrl, String relativeUrl) { + String result = null; + try { + URI baseUri = new URI(baseUrl); + URI absoluteUri = baseUri.resolve(relativeUrl); + // 屏蔽转URL,防止在baseUrl时无http(s)://的 protocol 导致的转换错误, 此时也可以处理 ws:// 等其他非http开头的地址 + /*URL absoluteUrl = absoluteUri.toURL(); + result = absoluteUrl.toString();*/ + + result = absoluteUri.toString(); + } catch (Exception e) { + // + } + return result; + } } diff --git a/spider-flow-web/pom.xml b/spider-flow-web/pom.xml index 8fb6c9304bfc5a908664dffa48e31c631ac2cce9..810119b1f262601f4b8162724785f08b22c5bc98 100644 --- a/spider-flow-web/pom.xml +++ b/spider-flow-web/pom.xml @@ -4,7 +4,7 @@ org.spiderflow spider-flow - 0.5.0 + 0.5.1-SNAPSHOT spider-flow-web spider-flow-web diff --git a/spider-flow-web/src/main/java/org/spiderflow/logback/SpiderFlowWebSocketAppender.java b/spider-flow-web/src/main/java/org/spiderflow/logback/SpiderFlowWebSocketAppender.java index 8fde974514ef7edce87250d129ce1fe7ce0ffa52..3503f2e19a2a5d00dfbc498456d2085d36bf887f 100644 --- a/spider-flow-web/src/main/java/org/spiderflow/logback/SpiderFlowWebSocketAppender.java +++ b/spider-flow-web/src/main/java/org/spiderflow/logback/SpiderFlowWebSocketAppender.java @@ -21,7 +21,8 @@ public class SpiderFlowWebSocketAppender extends UnsynchronizedAppenderBase arguments = argumentArray == null ? Collections.emptyList() : new ArrayList<>(Arrays.asList(argumentArray)); + // 20210121 Collections.emptyList() 长度不可变, 改为 new , 确保下方 add 能执行 + List arguments = argumentArray == null ? new ArrayList<>() : new ArrayList<>(Arrays.asList(argumentArray)); ThrowableProxy throwableProxy = (ThrowableProxy) event.getThrowableProxy(); if(throwableProxy != null){ arguments.add(throwableProxy.getThrowable());