diff --git a/doc/docs/files/90001_网关性能测试.md b/doc/docs/files/90001_网关性能测试.md index d005a802..cc2df6b9 100644 --- a/doc/docs/files/90001_网关性能测试.md +++ b/doc/docs/files/90001_网关性能测试.md @@ -133,8 +133,8 @@ Transfer/sec: 226.50KB `restart.sh` ```bash -echo "Stopping sop-gateway-4.2.1-SNAPSHOT.jar" -pid=`ps -ef | grep sop-gateway-4.2.1-SNAPSHOT.jar | grep -v grep | awk '{print $2}'` +echo "Stopping sop-gateway-4.2.2-SNAPSHOT.jar" +pid=`ps -ef | grep sop-gateway-4.2.2-SNAPSHOT.jar | grep -v grep | awk '{print $2}'` if [ -n "$pid" ] then echo "kill -9 的id:" $pid @@ -142,7 +142,7 @@ then fi nohup java -jar -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc.log \ -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8\ - -XX:+UseConcMarkSweepGC sop-gateway-4.2.1-SNAPSHOT.jar\ + -XX:+UseConcMarkSweepGC sop-gateway-4.2.2-SNAPSHOT.jar\ --spring.profiles.active=dev --server.port=8081 & tail -f nohup.out diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md index 940c85d8..f7879a1a 100644 --- a/doc/docs/files/90100_常见问题.md +++ b/doc/docs/files/90100_常见问题.md @@ -1,5 +1,9 @@ # 常见问题 +## primordials is not defined + +node版本太高导致与gulp版本不兼容,解决方法:node退回11版本。参考https://blog.csdn.net/zxxzxx23/article/details/103000393 + ## Nacos指定group 可在配置文件中添加:`spring.cloud.nacos.discovery.group=xxx`指定group,不加默认是:DEFAULT_GROUP diff --git a/doc/pom.xml b/doc/pom.xml index 0e490c84..9b44b804 100644 --- a/doc/pom.xml +++ b/doc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.gitee.sop doc - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index 0ad752ea..e8546b11 100644 --- a/pom.xml +++ b/pom.xml @@ -5,14 +5,14 @@ org.springframework.boot spring-boot-starter-parent - 2.3.4.RELEASE + 2.1.8.RELEASE 4.0.0 com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT pom 一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台 @@ -36,12 +36,12 @@ 1.8 - 2.3.4.RELEASE + 2.1.8.RELEASE - Hoxton.SR8 + Greenwich.SR6 - 2.2.3.RELEASE + 2.1.2.RELEASE @@ -135,6 +135,12 @@ ${easyopen.version} + + com.squareup.okhttp3 + okhttp + 3.14.7 + + net.oschina.durcframework easyopen-spring-boot-starter diff --git a/sop-admin/pom.xml b/sop-admin/pom.xml index caacc7dd..9d2696ae 100644 --- a/sop-admin/pom.xml +++ b/sop-admin/pom.xml @@ -6,13 +6,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml 4.0.0 sop-admin - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT pom diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml index 97f39640..3a1cbf8c 100644 --- a/sop-admin/sop-admin-server/pom.xml +++ b/sop-admin/sop-admin-server/pom.xml @@ -5,13 +5,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 sop-admin-server - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT jar @@ -76,6 +76,14 @@ spring-boot-starter-test test + + + junit + junit + 4.13 + test + + org.projectlombok lombok diff --git a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.f16786b7.js b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.cc77b01c.js similarity index 52% rename from sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.f16786b7.js rename to sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.cc77b01c.js index 2ee7ffca..ddf9e410 100644 --- a/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.f16786b7.js +++ b/sop-admin/sop-admin-server/src/main/resources/public/static/js/chunk-25908fca.cc77b01c.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-25908fca"],{"021d":function(e,t,a){},"0bac":function(e,t,a){"use strict";var s=a("021d"),o=a.n(s);o.a},cb56:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.searchFormData,size:"mini"}},[a("el-form-item",{attrs:{label:"AppId"}},[a("el-input",{staticStyle:{width:"250px"},attrs:{clearable:!0,placeholder:"AppId"},model:{value:e.searchFormData.appKey,callback:function(t){e.$set(e.searchFormData,"appKey",t)},expression:"searchFormData.appKey"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.onSearchTable}},[e._v("查询")])],1)],1),e._v(" "),a("el-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.onAdd}},[e._v("新增ISV")]),e._v(" "),a("el-table",{attrs:{data:e.pageInfo.list,border:"",fit:"","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"appKey",label:"AppId",width:"250"}}),e._v(" "),a("el-table-column",{attrs:{prop:"",label:"秘钥",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onShowKeys(t.row)}}},[e._v("查看")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"roleList",label:"角色","show-overflow-tooltip":!0},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",{domProps:{innerHTML:e._s(e.roleRender(t.row))}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"userId",label:"注册用户",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[t.row.userId?a("span",{staticStyle:{"font-weight":"bold"}},[e._v("是")]):a("span",[e._v("否")])]}}])},[a("template",{slot:"header"},[e._v("\n 注册用户\n "),a("el-tooltip",{attrs:{content:"注册用户自行管理秘钥",placement:"top"}},[a("i",{staticClass:"el-icon-question",staticStyle:{cursor:"pointer"}})])],1)],2),e._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.status?a("span",{staticStyle:{color:"#67C23A"}},[e._v("启用")]):e._e(),e._v(" "),2===t.row.status?a("span",{staticStyle:{color:"#F56C6C"}},[e._v("禁用")]):e._e()]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"gmtCreate",label:"添加时间",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{prop:"remark",label:"备注","show-overflow-tooltip":!0}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",width:"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onTableUpdate(t.row)}}},[e._v("修改")]),e._v(" "),t.row.userId?e._e():a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onKeysUpdate(t.row)}}},[e._v("秘钥管理")]),e._v(" "),t.row.userId?e._e():a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return e.onExportKeys(t.row)}}},[e._v("导出秘钥")])]}}])})],1),e._v(" "),a("el-pagination",{staticStyle:{"margin-top":"5px"},attrs:{background:"","current-page":e.searchFormData.pageIndex,"page-size":e.searchFormData.pageSize,"page-sizes":[5,10,20,40],total:e.pageInfo.total,layout:"total, sizes, prev, pager, next"},on:{"size-change":e.onSizeChange,"current-change":e.onPageIndexChange}}),e._v(" "),a("el-dialog",{attrs:{title:e.isvDialogTitle,visible:e.isvDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.isvDialogVisible=t},close:e.onIsvDialogClose}},[a("el-form",{ref:"isvForm",attrs:{rules:e.rulesIsvForm,model:e.isvDialogFormData,"label-width":"120px",size:"mini"}},[a("el-form-item",{attrs:{label:"appId"}},[0===e.isvDialogFormData.id?a("span",{staticStyle:{color:"gray"}},[e._v("(系统自动生成)")]):a("span",[e._v(e._s(e.isvDialogFormData.appKey))])]),e._v(" "),a("el-form-item",{attrs:{label:"角色"}},[a("el-checkbox-group",{model:{value:e.isvDialogFormData.roleCode,callback:function(t){e.$set(e.isvDialogFormData,"roleCode",t)},expression:"isvDialogFormData.roleCode"}},e._l(e.roles,function(t){return a("el-checkbox",{key:t.roleCode,attrs:{label:t.roleCode}},[e._v(e._s(t.description))])}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"remark"}},[a("el-input",{attrs:{type:"textarea"},model:{value:e.isvDialogFormData.remark,callback:function(t){e.$set(e.isvDialogFormData,"remark",t)},expression:"isvDialogFormData.remark"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"状态"}},[a("el-radio-group",{model:{value:e.isvDialogFormData.status,callback:function(t){e.$set(e.isvDialogFormData,"status",t)},expression:"isvDialogFormData.status"}},[a("el-radio",{attrs:{label:1,name:"status"}},[e._v("启用")]),e._v(" "),a("el-radio",{attrs:{label:2,name:"status"}},[e._v("禁用")])],1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.isvDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary",disabled:e.isSaveButtonDisabled},on:{click:e.onIsvDialogSave}},[e._v("保 存")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"秘钥信息",visible:e.isvKeysDialogVisible},on:{"update:visible":function(t){e.isvKeysDialogVisible=t},close:function(t){return e.resetForm("isvKeysFrom")}}},[a("el-form",{ref:"isvKeysFrom",staticClass:"key-view",attrs:{model:e.isvKeysFormData,"label-width":"160px",size:"mini"}},[a("el-form-item",{attrs:{label:""}},[a("el-alert",{attrs:{title:"带 ★ 的分配给开发者",type:"warning",closable:!1}})],1),e._v(" "),a("el-form-item",{attrs:{label:e.selfLabel("appId")}},[a("span",[e._v(e._s(e.isvKeysFormData.appKey))])]),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}],attrs:{label:"秘钥格式"}},[1===e.isvKeysFormData.keyFormat?a("span",[e._v("PKCS8(JAVA适用)")]):e._e(),e._v(" "),2===e.isvKeysFormData.keyFormat?a("span",[e._v("PKCS1(非JAVA适用)")]):e._e()]),e._v(" "),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:2===e.isvKeysFormData.signType,expression:"isvKeysFormData.signType === 2"}],attrs:{label:e.selfLabel("secret")}},[a("span",[e._v(e._s(e.isvKeysFormData.secret))])]),e._v(" "),a("el-tabs",{directives:[{name:"show",rawName:"v-show",value:e.showKeys(),expression:"showKeys()"}],staticClass:"keyTabs",attrs:{type:"card"},model:{value:e.activeName,callback:function(t){e.activeName=t},expression:"activeName"}},[a("el-tab-pane",{attrs:{label:"ISV公私钥",name:"first"}},[a("el-form-item",{attrs:{label:"ISV公钥"}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.publicKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyIsv",t)},expression:"isvKeysFormData.publicKeyIsv"}})],1),e._v(" "),a("el-form-item",{attrs:{label:e.selfLabel("ISV私钥")}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.privateKeyIsv,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyIsv",t)},expression:"isvKeysFormData.privateKeyIsv"}})],1)],1),e._v(" "),a("el-tab-pane",{attrs:{label:"平台公私钥[可选]",name:"second"}},[a("el-form-item",{attrs:{label:"平台公钥"}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.publicKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"publicKeyPlatform",t)},expression:"isvKeysFormData.publicKeyPlatform"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"privateKeyPlatform",label:"平台私钥"}},[a("el-input",{attrs:{type:"textarea",readonly:""},model:{value:e.isvKeysFormData.privateKeyPlatform,callback:function(t){e.$set(e.isvKeysFormData,"privateKeyPlatform",t)},expression:"isvKeysFormData.privateKeyPlatform"}})],1)],1)],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.isvKeysDialogVisible=!1}}},[e._v("关 闭")])],1)],1)],1)},o=[],i={data:function(){return{searchFormData:{appKey:"",pageIndex:1,pageSize:10},pageInfo:{list:[],total:0},roles:[],isvDialogVisible:!1,isvDialogTitle:"新增ISV",isvDialogFormData:{id:0,status:1,remark:"",roleCode:[]},rulesIsvForm:{remark:[{min:0,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}]},activeName:"first",isSaveButtonDisabled:!1,isvKeysDialogVisible:!1,isvKeysFormData:{appKey:"",secret:"",publicKeyIsv:"",privateKeyIsv:"",publicKeyPlatform:"",privateKeyPlatform:"",signType:""}}},created:function(){this.loadTable(),this.loadRouteRole()},methods:{loadTable:function(){this.post("isv.info.page",this.searchFormData,function(e){this.pageInfo=e.data})},loadRouteRole:function(){0===this.roles.length&&this.post("role.listall",{},function(e){this.roles=e.data})},onShowKeys:function(e){this.post("isv.keys.get",{appKey:e.appKey},function(e){var t=this;this.isvKeysDialogVisible=!0,this.$nextTick(function(){Object.assign(t.isvKeysFormData,e.data)})})},onSearchTable:function(){this.loadTable()},onTableUpdate:function(e){var t=this;this.isvDialogTitle="修改ISV",this.isvDialogVisible=!0,this.$nextTick(function(){t.post("isv.info.get",{id:e.id},function(e){for(var t=e.data,a=t.roleList,s=[],o=0;o - - - - + {{ isvKeysFormData.appKey }} PKCS8(JAVA适用) PKCS1(非JAVA适用) - + {{ isvKeysFormData.secret }} - + - + - + @@ -235,7 +228,8 @@ export default { privateKeyIsv: '', publicKeyPlatform: '', privateKeyPlatform: '', - signType: '' + signType: '', + userId: 0 } } }, @@ -261,6 +255,7 @@ export default { this.isvKeysDialogVisible = true this.$nextTick(() => { Object.assign(this.isvKeysFormData, resp.data) + this.isvKeysFormData.userId = row.userId }) }) }, @@ -333,9 +328,6 @@ export default { this.isvDialogFormData.status = 1 this.isvDialogFormData.roleCode = [] }, - selfLabel: function(lab) { - return '★ ' + lab - }, roleRender: function(row) { const html = [] const roleList = row.roleList diff --git a/sop-auth/pom.xml b/sop-auth/pom.xml index 916af6fc..8e9ec6c5 100644 --- a/sop-auth/pom.xml +++ b/sop-auth/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml @@ -25,7 +25,7 @@ com.gitee.sop sop-service-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT @@ -37,7 +37,7 @@ com.gitee.sop sdk-java - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-common/pom.xml b/sop-common/pom.xml index b47d704a..425b1b8a 100644 --- a/sop-common/pom.xml +++ b/sop-common/pom.xml @@ -6,7 +6,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml diff --git a/sop-common/sop-bridge-eureka/pom.xml b/sop-common/sop-bridge-eureka/pom.xml index 30da75c1..812d8e60 100644 --- a/sop-common/sop-bridge-eureka/pom.xml +++ b/sop-common/sop-bridge-eureka/pom.xml @@ -5,12 +5,12 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT sop-bridge-eureka @@ -18,7 +18,7 @@ com.gitee.sop sop-gateway-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-common/sop-bridge-nacos/pom.xml b/sop-common/sop-bridge-nacos/pom.xml index 7e8a4e74..d7eb1563 100644 --- a/sop-common/sop-bridge-nacos/pom.xml +++ b/sop-common/sop-bridge-nacos/pom.xml @@ -5,12 +5,12 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT sop-bridge-nacos @@ -18,7 +18,7 @@ com.gitee.sop sop-gateway-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml index a3b7b0cc..0ffb58f8 100644 --- a/sop-common/sop-gateway-common/pom.xml +++ b/sop-common/sop-gateway-common/pom.xml @@ -5,13 +5,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 sop-gateway-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT jar diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/GatewayPredicateDefinition.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/GatewayPredicateDefinition.java index 06a6c0e5..db9b4d62 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/GatewayPredicateDefinition.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/GatewayPredicateDefinition.java @@ -3,7 +3,6 @@ package com.gitee.sop.gatewaycommon.bean; import lombok.Data; import org.springframework.util.StringUtils; -import javax.validation.ValidationException; import java.util.LinkedHashMap; import java.util.Map; @@ -24,7 +23,7 @@ public class GatewayPredicateDefinition { public GatewayPredicateDefinition(String text) { int eqIdx = text.indexOf(61); if (eqIdx <= 0) { - throw new ValidationException("Unable to parse GatewayPredicateDefinition text '" + text + "', must be of the form name=value"); + throw new RuntimeException("Unable to parse GatewayPredicateDefinition text '" + text + "', must be of the form name=value"); } else { this.setName(text.substring(0, eqIdx)); String[] params = StringUtils.tokenizeToStringArray(text.substring(eqIdx + 1), ","); diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/ServerWebExchangeUtil.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/ServerWebExchangeUtil.java index e73688bf..93c76f88 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/ServerWebExchangeUtil.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/ServerWebExchangeUtil.java @@ -3,7 +3,6 @@ package com.gitee.sop.gatewaycommon.gateway; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.gitee.sop.gatewaycommon.bean.SopConstants; -import com.gitee.sop.gatewaycommon.gateway.codec.MessageReaderFactory; import com.gitee.sop.gatewaycommon.gateway.common.FileUploadHttpServletRequest; import com.gitee.sop.gatewaycommon.gateway.common.RequestContentDataExtractor; import com.gitee.sop.gatewaycommon.gateway.common.SopServerHttpRequestDecorator; @@ -23,6 +22,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.util.MultiValueMap; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.commons.CommonsMultipartResolver; +import org.springframework.web.reactive.function.server.HandlerStrategies; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilterChain; @@ -47,7 +47,7 @@ public class ServerWebExchangeUtil { private static final FormHttpMessageConverter formHttpMessageConverter = new FormHttpMessageConverter(); - private static final List> messageReaders = MessageReaderFactory.build(); + private static final List> messageReaders = HandlerStrategies.withDefaults().messageReaders(); /** * 重定向 diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java deleted file mode 100644 index b81f1eec..00000000 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/codec/MessageReaderFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.gitee.sop.gatewaycommon.gateway.codec; - -import com.gitee.sop.gatewaycommon.manager.EnvironmentKeys; -import org.springframework.core.codec.AbstractDataBufferDecoder; -import org.springframework.core.codec.Decoder; -import org.springframework.http.codec.DecoderHttpMessageReader; -import org.springframework.http.codec.HttpMessageReader; -import org.springframework.util.ReflectionUtils; -import org.springframework.web.reactive.function.client.ExchangeStrategies; -import org.springframework.web.reactive.function.server.HandlerStrategies; - -import java.lang.reflect.Method; -import java.util.List; - -/** - * @author tanghc - */ -public class MessageReaderFactory { - - public static final String METHOD_SET_MAX_IN_MEMORY_SIZE = "setMaxInMemorySize"; - public static final String METHOD_GET_DECODER = "getDecoder"; - public static final int DEFAULT_SIZE = 256 * 1024; - - public static List> build() { - String maxInMemorySizeValueStr = EnvironmentKeys.MAX_IN_MEMORY_SIZE.getValue(); - int maxInMemorySizeValue = Integer.parseInt(maxInMemorySizeValueStr); - List> messageReaders = HandlerStrategies.withDefaults().messageReaders(); - if (DEFAULT_SIZE == maxInMemorySizeValue) { - return messageReaders; - } - // 设置POST缓存大小 - for (HttpMessageReader httpMessageReader : messageReaders) { - Method[] methods = ReflectionUtils.getDeclaredMethods(httpMessageReader.getClass()); - for (Method method : methods) { - String methodName = method.getName(); - if (METHOD_SET_MAX_IN_MEMORY_SIZE.equals(methodName)) { - ReflectionUtils.invokeMethod(method, httpMessageReader, maxInMemorySizeValue); - } else if (METHOD_GET_DECODER.equals(methodName)) { - Object decoder = ReflectionUtils.invokeMethod(method, httpMessageReader); - if (decoder instanceof AbstractDataBufferDecoder) { - AbstractDataBufferDecoder bufferDecoder = (AbstractDataBufferDecoder) decoder; - bufferDecoder.setMaxInMemorySize(maxInMemorySizeValue); - } - } - } - } - return messageReaders; - } - - public static void initMaxInMemorySize(ExchangeStrategies exchangeStrategies) { - // 修复返回大文本数据报org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144 - String maxInMemorySizeValueStr = EnvironmentKeys.MAX_IN_MEMORY_SIZE.getValue(); - int maxInMemorySizeValue = Integer.parseInt(maxInMemorySizeValueStr); - if (DEFAULT_SIZE == maxInMemorySizeValue) { - return; - } - for (HttpMessageReader messageReader : exchangeStrategies.messageReaders()) { - if (messageReader instanceof DecoderHttpMessageReader) { - DecoderHttpMessageReader reader = (DecoderHttpMessageReader) messageReader; - Decoder decoder = reader.getDecoder(); - if (decoder instanceof AbstractDataBufferDecoder) { - AbstractDataBufferDecoder dataBufferDecoder = (AbstractDataBufferDecoder)decoder; - dataBufferDecoder.setMaxInMemorySize(maxInMemorySizeValue); - } - } - } - } -} diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java index 2167b8a2..4d3bc4c1 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java @@ -2,7 +2,6 @@ package com.gitee.sop.gatewaycommon.gateway.filter; import com.gitee.sop.gatewaycommon.bean.ApiContext; import com.gitee.sop.gatewaycommon.bean.SopConstants; -import com.gitee.sop.gatewaycommon.gateway.codec.MessageReaderFactory; import com.gitee.sop.gatewaycommon.result.ResultExecutor; import org.apache.commons.lang3.StringUtils; import org.reactivestreams.Publisher; @@ -60,7 +59,7 @@ public class GatewayModifyResponseGatewayFilter implements GlobalFilter, Ordered //this will prevent exception in case of using non-standard media types like "Content-Type: image" httpHeaders.add(HttpHeaders.CONTENT_TYPE, originalResponseContentType); ResponseAdapter responseAdapter = new ResponseAdapter(body, httpHeaders); - DefaultClientResponse clientResponse = new DefaultClientResponse(responseAdapter, getExchangeStrategies()); + DefaultClientResponse clientResponse = new DefaultClientResponse(responseAdapter, ExchangeStrategies.withDefaults()); //TODO: flux or mono Mono modifiedBody = clientResponse.bodyToMono(inClass) @@ -97,13 +96,6 @@ public class GatewayModifyResponseGatewayFilter implements GlobalFilter, Ordered return chain.filter(exchange.mutate().response(responseDecorator).build()); } - private ExchangeStrategies getExchangeStrategies() { - ExchangeStrategies exchangeStrategies = ExchangeStrategies.withDefaults(); - // 修复返回大文本数据报org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144 - MessageReaderFactory.initMaxInMemorySize(exchangeStrategies); - return exchangeStrategies; - } - @Override public int getOrder() { return NettyWriteResponseFilter.WRITE_RESPONSE_FILTER_ORDER - 1; diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml index f8186814..ab91d3c9 100644 --- a/sop-common/sop-service-common/pom.xml +++ b/sop-common/sop-service-common/pom.xml @@ -6,13 +6,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 sop-service-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT jar diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java index 9525532b..7da6a510 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java @@ -1,28 +1,9 @@ package com.gitee.sop.servercommon.configuration; -import com.gitee.sop.servercommon.bean.ServiceConfig; -import com.gitee.sop.servercommon.param.SopHandlerMethodArgumentResolver; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; - /** * 具备支付宝开放平台服务提供能力 * @author tanghc */ public class AlipayServiceConfiguration extends BaseServiceConfiguration { - static { - // 默认版本号为1.0 - ServiceConfig.getInstance().setDefaultVersion("1.0"); - } - - @Autowired - private RequestMappingHandlerAdapter requestMappingHandlerAdapter; - - @Override - protected void doAfter() { - super.doAfter(); - SopHandlerMethodArgumentResolver sopHandlerMethodArgumentResolver = ServiceConfig.getInstance().getMethodArgumentResolver(); - sopHandlerMethodArgumentResolver.setRequestMappingHandlerAdapter(requestMappingHandlerAdapter); - } } diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/SpringmvcConfiguration.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/SpringmvcConfiguration.java index 66037578..a76fbbc2 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/SpringmvcConfiguration.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/SpringmvcConfiguration.java @@ -3,8 +3,11 @@ package com.gitee.sop.servercommon.configuration; import com.gitee.sop.servercommon.bean.ServiceConfig; import com.gitee.sop.servercommon.interceptor.ServiceContextInterceptor; import com.gitee.sop.servercommon.message.ServiceErrorFactory; +import com.gitee.sop.servercommon.param.SopHandlerMethodArgumentResolver; import com.gitee.sop.servercommon.route.ServiceRouteController; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; @@ -12,6 +15,7 @@ import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import javax.annotation.PostConstruct; import java.nio.charset.StandardCharsets; @@ -21,10 +25,14 @@ import java.util.List; * @author tanghc */ @Slf4j -public class SpringmvcConfiguration implements WebMvcConfigurer { +public class SpringmvcConfiguration implements WebMvcConfigurer, BeanPostProcessor { public static final String METADATA_SERVER_CONTEXT_PATH = "server.servlet.context-path"; + static { + ServiceConfig.getInstance().setDefaultVersion("1.0"); + } + public SpringmvcConfiguration() { ServiceConfig.getInstance().getI18nModules().add("i18n/isp/bizerror"); } @@ -33,6 +41,16 @@ public class SpringmvcConfiguration implements WebMvcConfigurer { System.setProperty("eureka.instance.metadata-map.server.startup-time", String.valueOf(System.currentTimeMillis())); } + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + if (bean instanceof RequestMappingHandlerAdapter) { + RequestMappingHandlerAdapter requestMappingHandlerAdapter = (RequestMappingHandlerAdapter) bean; + SopHandlerMethodArgumentResolver sopHandlerMethodArgumentResolver = ServiceConfig.getInstance().getMethodArgumentResolver(); + sopHandlerMethodArgumentResolver.setRequestMappingHandlerAdapter(requestMappingHandlerAdapter); + } + return bean; + } + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // 支持swagger-bootstrap-ui首页 diff --git a/sop-example/pom.xml b/sop-example/pom.xml index 0586602d..94435567 100644 --- a/sop-example/pom.xml +++ b/sop-example/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml diff --git a/sop-example/sop-springmvc/pom.xml b/sop-example/sop-springmvc/pom.xml index fe0cda9e..cd0d9e72 100644 --- a/sop-example/sop-springmvc/pom.xml +++ b/sop-example/sop-springmvc/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml @@ -26,7 +26,7 @@ com.gitee.sop sop-service-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-example/sop-springmvc/src/main/java/com/gitee/app/config/OpenServiceConfig.java b/sop-example/sop-springmvc/src/main/java/com/gitee/app/config/OpenServiceConfig.java index f9ddde68..3ff8e33b 100644 --- a/sop-example/sop-springmvc/src/main/java/com/gitee/app/config/OpenServiceConfig.java +++ b/sop-example/sop-springmvc/src/main/java/com/gitee/app/config/OpenServiceConfig.java @@ -6,7 +6,6 @@ import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.client.naming.utils.NetUtils; import com.alibaba.nacos.spring.context.annotation.discovery.EnableNacosDiscovery; -import com.gitee.sop.servercommon.bean.ServiceConfig; import com.gitee.sop.servercommon.configuration.SpringmvcConfiguration; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -27,10 +26,6 @@ public class OpenServiceConfig extends SpringmvcConfiguration { public static final String SERVER_PORT = "server.port"; public static final String METADATA_TIME_STARTUP = "server.startup-time"; - static { - ServiceConfig.getInstance().setDefaultVersion("1.0"); - } - @Value("${spring.application.name}") private String serviceId; @Value("${server.port}") diff --git a/sop-example/sop-springmvc/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/sop-example/sop-springmvc/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml index e8140fce..b5893103 100644 --- a/sop-example/sop-springmvc/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml +++ b/sop-example/sop-springmvc/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml @@ -31,12 +31,7 @@ - - - - - - + diff --git a/sop-example/sop-story/pom.xml b/sop-example/sop-story/pom.xml index 1bc7278c..ce594f95 100644 --- a/sop-example/sop-story/pom.xml +++ b/sop-example/sop-story/pom.xml @@ -4,7 +4,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml @@ -19,7 +19,7 @@ com.gitee.sop sop-service-common - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index a667fbec..775572e9 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -4,7 +4,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml @@ -24,7 +24,7 @@ com.gitee.sop sop-bridge-eureka - 4.2.0-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-sdk/pom.xml b/sop-sdk/pom.xml index ae6a809c..10242e19 100644 --- a/sop-sdk/pom.xml +++ b/sop-sdk/pom.xml @@ -6,13 +6,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml 4.0.0 sop-sdk - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT pom diff --git a/sop-sdk/sdk-java/pom.xml b/sop-sdk/sdk-java/pom.xml index 0eb739d6..37700197 100644 --- a/sop-sdk/sdk-java/pom.xml +++ b/sop-sdk/sdk-java/pom.xml @@ -4,13 +4,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../../pom.xml 4.0.0 sdk-java - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT diff --git a/sop-test/pom.xml b/sop-test/pom.xml index 7708e12c..c8fb1282 100644 --- a/sop-test/pom.xml +++ b/sop-test/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml diff --git a/sop-website/pom.xml b/sop-website/pom.xml index d0b13c12..05af41ea 100644 --- a/sop-website/pom.xml +++ b/sop-website/pom.xml @@ -6,13 +6,13 @@ com.gitee.sop sop-parent - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml 4.0.0 sop-website - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT pom diff --git a/sop-website/sop-portal/README.md b/sop-website/sop-portal/README.md index 41e59a5b..3d587bbd 100644 --- a/sop-website/sop-portal/README.md +++ b/sop-website/sop-portal/README.md @@ -4,6 +4,10 @@ # 初始化 +安装node,建议安装11版本,12版本会有不兼容问题。 + +安装完毕执行: + npm install # 启动 diff --git a/sop-website/sop-website-server/pom.xml b/sop-website/sop-website-server/pom.xml index afaaa449..a694d4de 100644 --- a/sop-website/sop-website-server/pom.xml +++ b/sop-website/sop-website-server/pom.xml @@ -5,7 +5,7 @@ com.gitee.sop sop-website - 4.2.1-SNAPSHOT + 4.2.2-SNAPSHOT ../pom.xml @@ -25,7 +25,7 @@ com.gitee.sop sop-bridge-eureka - 4.2.0-SNAPSHOT + 4.2.2-SNAPSHOT