BUG修复

This commit is contained in:
mxd 2019-07-30 21:12:09 +08:00
parent 294e75545f
commit cbb4abe259
4 changed files with 16 additions and 6 deletions

View File

@ -71,7 +71,7 @@ public class RequestExecutor implements Executor{
ExceptionUtils.wrapAndThrow(e);
}
if(logger.isDebugEnabled()){
logger.debug("设置请求url:{}" + url);
logger.debug("设置请求url:{}" , url);
}
context.log(String.format("设置请求url:%s", url));
request.url(url);

View File

@ -12,6 +12,7 @@ import org.spiderflow.core.freemarker.functions.FreemarkerTemplateMethodModel;
import org.spiderflow.core.freemarker.functions.utils.Base64FunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.DateFunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.FileFunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.JsonFunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.ListFunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.RandomFunctionUtils;
import org.spiderflow.core.freemarker.functions.utils.StringFunctionUtils;
@ -88,6 +89,7 @@ public class FreeMarkerEngine {
configuration.setSharedVariable("math", model.get(Math.class.getName()));
configuration.setSharedVariable("url", model.get(UrlFunctionUtils.class.getName()));
configuration.setSharedVariable("file", model.get(FileFunctionUtils.class.getName()));
configuration.setSharedVariable("json", model.get(JsonFunctionUtils.class.getName()));
}
public Object execute(String expression,Map<String,Object> variables){

View File

@ -70,7 +70,7 @@ public class HttpRequest {
public HttpRequest data(String key,Object value){
if(value != null){
return data(key,data.toString());
return data(key,value.toString());
}
return this;
}
@ -114,6 +114,4 @@ public class HttpRequest {
Response response = connection.execute();
return new HttpResponse(response);
}
}

View File

@ -5,6 +5,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringEscapeUtils;
import com.alibaba.fastjson.JSONArray;
/**
@ -52,7 +54,11 @@ public class SpiderNode {
}
public String getStringJsonValue(String key){
return (String) this.jsonProperty.get(key);
String value = (String) this.jsonProperty.get(key);
if(value != null){
value = StringEscapeUtils.unescapeHtml4(value);
}
return value;
}
public List<Map<String,String>> getListJsonValue(String ... keys){
@ -73,7 +79,11 @@ public class SpiderNode {
for (int i = 0;i < size;i++) {
Map<String,String> item = new HashMap<>();
for (int j = 0; j < keys.length; j++) {
item.put(keys[j],arrays.get(j).getString(i));
String val = arrays.get(j).getString(i);
if(val != null){
val = StringEscapeUtils.unescapeHtml4(val);
}
item.put(keys[j],val);
}
result.add(item);
}