优化客户端配置,增加server.web.path=/选项,与服务端context-path配置进行对应

This commit is contained in:
seagull 2020-09-22 18:38:19 +08:00
parent 1e9b01098a
commit da928edc9d
6 changed files with 8 additions and 10 deletions

View File

@ -53,7 +53,7 @@
<p><b>用例由于长时间未收到接口Response未执行完成</b> 【<font color='#FFAD86'>${caseunex}</font>】</p> <p><b>用例由于长时间未收到接口Response未执行完成</b> 【<font color='#FFAD86'>${caseunex}</font>】</p>
<p>&nbsp;</p> <p>&nbsp;</p>
<p> 此为自动化平台LuckyFrame的系统邮件请勿回复</p> <p> 此为自动化平台LuckyFrame的系统邮件请勿回复</p>
<p> 请及时前往<a href='http://${webip}:${webport}'>LuckyFrame平台</a>查看您的任务执行的更多细节</p> <p> 请及时前往<a href='http://${webip}:${webport}${webpath}'>LuckyFrame平台</a>查看您的任务执行的更多细节</p>
<p> <p>
</div> </div>
</div> </div>

View File

@ -3,6 +3,8 @@ client.verison=3.3
client.name=测试客户端 client.name=测试客户端
server.web.ip=localhost server.web.ip=localhost
server.web.port=80 server.web.port=80
#对应服务端项目的contextPath 默认路径 /
server.web.path=/
#===============================netty配置===================================== #===============================netty配置=====================================
#netty.model为netty模式开启 例true false 注意netty.host为空时默认使用IP #netty.model为netty模式开启 例true false 注意netty.host为空时默认使用IP
netty.model=true netty.model=true

View File

@ -417,11 +417,4 @@ public class SubString {
LogUtil.APP.info("获取JSON字符串指定jsonPath表达式【{}】的值是:{}",expression,jsonString); LogUtil.APP.info("获取JSON字符串指定jsonPath表达式【{}】的值是:{}",expression,jsonString);
return jsonString; return jsonString;
} }
public static void main(String[] args) {
String jsonString="{\"Success\":false,\"Text\":\"²Ù×÷ʧ°Ü\"}";
String expression = "$.Success";
jsonString=JsonPath.parse(jsonString).read(expression).toString();
System.out.println(jsonString);
}
} }

View File

@ -27,6 +27,7 @@ public class FreemarkerEmailTemplate {
*/ */
private final String WEB_IP = properties.getProperty("server.web.ip"); private final String WEB_IP = properties.getProperty("server.web.ip");
private final String WEB_PORT = properties.getProperty("server.web.port"); private final String WEB_PORT = properties.getProperty("server.web.port");
private final String WEB_PATH = properties.getProperty("server.web.path");
/** /**
* 启动模板缓存 * 启动模板缓存
*/ */
@ -56,6 +57,7 @@ public class FreemarkerEmailTemplate {
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
parameters.put("webip", WEB_IP); parameters.put("webip", WEB_IP);
parameters.put("webport", WEB_PORT); parameters.put("webport", WEB_PORT);
parameters.put("webpath", WEB_PATH);
template.process(parameters, stringWriter); template.process(parameters, stringWriter);
return stringWriter.toString(); return stringWriter.toString();
} catch (Exception e) { } catch (Exception e) {

View File

@ -108,6 +108,7 @@ public class MailSendInitialization {
if(StrUtil.isNotBlank(pushUrl)){ if(StrUtil.isNotBlank(pushUrl)){
String ip = properties.getProperty("server.web.ip"); String ip = properties.getProperty("server.web.ip");
String port = properties.getProperty("server.web.port"); String port = properties.getProperty("server.web.port");
String path = properties.getProperty("server.web.path");
ProjectProtocolTemplate ppt = new ProjectProtocolTemplate(); ProjectProtocolTemplate ppt = new ProjectProtocolTemplate();
ppt.setEncoding("utf-8"); ppt.setEncoding("utf-8");
@ -126,7 +127,7 @@ public class MailSendInitialization {
"用例执行失败:【" + taskCount[2] + "\n" + "用例执行失败:【" + taskCount[2] + "\n" +
"用例有可能由于脚本原因未成功解析被锁定:【" + taskCount[3] + "\n" + "用例有可能由于脚本原因未成功解析被锁定:【" + taskCount[3] + "\n" +
"用例由于长时间未收到接口Response未执行完成" + taskCount[4] + "\n" + "用例由于长时间未收到接口Response未执行完成" + taskCount[4] + "\n" +
"详情请前往自动化测试平台查看http://" + ip + ":" + port; "详情请前往自动化测试平台查看http://" + ip + ":" + port + path;
} }
JSONObject contentJson = JSON.parseObject("{\"content\": \"" + content + "\"}"); JSONObject contentJson = JSON.parseObject("{\"content\": \"" + content + "\"}");

View File

@ -31,7 +31,7 @@ import java.util.Properties;
public class HttpRequest { public class HttpRequest {
final static Properties PROPERTIES = SysConfig.getConfiguration(); final static Properties PROPERTIES = SysConfig.getConfiguration();
private final static String WEB_URL = "http://" + PROPERTIES.getProperty("server.web.ip") + ":" private final static String WEB_URL = "http://" + PROPERTIES.getProperty("server.web.ip") + ":"
+ PROPERTIES.getProperty("server.web.port"); + PROPERTIES.getProperty("server.web.port")+ PROPERTIES.getProperty("server.web.path");
/** /**
* 字符串参数 * 字符串参数