Commit 243d9f4e authored by “yiyousong”'s avatar “yiyousong”
parents 06d7ba46 c1216348
......@@ -115,22 +115,39 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
String domainUrl = "";
if (!ObjectUtils.isEmpty(params.getServerName()) && Validator.isIpv4(params.getServerName())) {
domainUrl = UrlBuilder.ofHttp(params.getServerName()).setPort(params.getServerPort() > 0 ? params.getServerPort() : 11078).build();
domainUrl = StrUtil.sub(domainUrl, 0, domainUrl.length() - 1);
}else {
// domainUrl = GlobalSysInfo.getParamValue(Constant.PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11078");
domainUrl="";
}
if (!ObjectUtils.isEmpty(siteEntity)) {
//请求地址 http://domian/app/siteCode/appcode/html
item.setCustUrl(UrlBuilder.ofHttp(params.getServerName()).setPort(params.getServerPort() > 0 ? params.getServerPort() : 11078)
if(!ObjectUtils.isEmpty(domainUrl)){
item.setCustUrl(UrlBuilder.ofHttp(domainUrl)
.addPath(CUSTAPP_ROOT_PATH)
.addPath(siteEntity.getSiteCode())
.addPath(item.getAppCode())
.addPath(item.getVersion().toString())
.build());
}else{
item.setCustUrl(CUSTAPP_ROOT_PATH+"/"+siteEntity.getSiteCode()+"/"+item.getAppCode()+"/"+item.getVersion());
}
} else {
item.setCustUrl("");
}
//构建图标地址
item.setAppIconUrl(UrlBuilder.ofHttp(params.getServerName()).setPort(params.getServerPort() > 0 ? params.getServerPort() : 11078)
if(!ObjectUtils.isEmpty(domainUrl)){
item.setAppIconUrl(UrlBuilder.ofHttp(domainUrl)
.addPath(item.getAppIconPath()).build());
}else{
item.setAppIconUrl(item.getAppIconPath());
}
});
super.findAfter(params, pageInfo, context, list);
}
......
......@@ -53,6 +53,28 @@ Content-Type: application/json
"url":"http://172.15.28.113:8900"
}
###参数信息更新与保存
POST {{baseUrl}}/param/save
Authorization: {{authToken}}
Content-Type: application/json
{
"name":"upd19g",
"firstOrganize":"2pdzk6",
"secondOrganize":"4glkoo",
"paramKey":"isynj7",
"paramValue":"t09yd7",
"validStatus":1,
"modStatus":4,
"displayType":0,
"remark":"z5lbzt",
"createUserName":"75on7u"
}
> {%
client.global.set("Param_id", JSON.parse(response.body).data.id);
%}
###test Cookie
POST {{baseUrl}}/test/testCookie
Content-Type: application/json
......
......@@ -92,19 +92,21 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
AccessLogPdu accessLogPdu = new AccessLogPdu();
accessLogPdu.initAttrValue();
accessLogPdu.setAppName(appName);
accessLogPdu.setTraceID(headers.getOrDefault(TRACE_ID,""));
accessLogPdu.setPspanId(Integer.parseInt(headers.getOrDefault(PSPAN_ID,"0")));
accessLogPdu.setSpanId(Integer.parseInt(headers.getOrDefault(SPAN_ID,"1")));
accessLogPdu.setTraceID(headers.getOrDefault(TRACE_ID, ""));
accessLogPdu.setPspanId(Integer.parseInt(headers.getOrDefault(PSPAN_ID, "0")));
accessLogPdu.setSpanId(Integer.parseInt(headers.getOrDefault(SPAN_ID, "1")));
accessLogPdu.setSchemaData(request.getURI().getScheme());
accessLogPdu.setHostName(NetUtil.getLocalHostName());
accessLogPdu.setHostName(request.getHeaders().getHost().getHostName());
accessLogPdu.setUri(requestPath);
accessLogPdu.setTargetServer(route.getId());
accessLogPdu.setRequestIp(IpUtils.getRealIpAddress(exchange.getRequest()));
accessLogPdu.setUa(headers.getOrDefault("User-Agent",""));
accessLogPdu.setUa(headers.getOrDefault("User-Agent", ""));
accessLogPdu.setRequestTime(new Date());
accessLogPdu.setLogTime(new Date());
accessLogPdu.setMethod(request.getMethodValue());
log.info("origin uri:{} host:{} port:{}",requestPath,request.getHeaders().getHost().getHostName(),request.getHeaders().getHost().getPort());
MediaType mediaType = request.getHeaders().getContentType();
if (MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(mediaType) || MediaType.APPLICATION_JSON.isCompatibleWith(mediaType)) {
return writeBodyLog(exchange, chain, accessLogPdu);
......@@ -161,12 +163,8 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
BodyInserter bodyInserter = BodyInserters.fromPublisher(modifiedBody, String.class);
HttpHeaders headers = new HttpHeaders();
headers.putAll(exchange.getRequest().getHeaders());
// the new content type will be computed by bodyInserter
// and then set in the request decorator
headers.remove(HttpHeaders.CONTENT_LENGTH);
CachedBodyOutputMessage outputMessage = new CachedBodyOutputMessage(exchange, headers);
return bodyInserter.insert(outputMessage, new BodyInserterContext())
.then(Mono.defer(() -> {
// 重新封装请求
......@@ -234,7 +232,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
private ServerHttpResponseDecorator recordResponseLog(ServerWebExchange exchange, AccessLogPdu accessLogPdu) {
ServerHttpResponse response = exchange.getResponse();
DataBufferFactory bufferFactory = response.bufferFactory();
return new ServerHttpResponseDecorator(response) {
@Override
public Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
......@@ -264,7 +261,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
//accessLogPdu.setResponseData(StrUtil.maxLength(responseResult,3000));
return bufferFactory.wrap(content);
}));*/
}else {
} else {
accessLogPdu.setResponseData(JSON.toJSONString(Rest.fail()));
}
}
......
......@@ -135,10 +135,10 @@ security:
- /auth/xcxLogin
- /auth/register
- /resource/sms/code
logging:
level:
reactor.netty: info
org.springframework.cloud.gateway: TRACE
#logging:
# level:
# reactor.netty: info
# org.springframework.cloud.gateway: TRACE
......
......@@ -39,6 +39,7 @@
<file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
</rollingPolicy>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment