tanghc 6 years ago
parent 5b32524a83
commit c359bf2fb0
  1. 16
      sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/filter/BaseZuulFilter.java
  2. 10
      sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ApiMetaContext.java
  3. 11
      sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/ResultExecutor.java
  4. 1
      sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/validate/SignEncipher.java
  5. 4
      sop-server-common/src/main/java/com/gitee/sop/servercommon/manager/ApiMetaManager.java
  6. 4
      sop-server-common/src/main/java/com/gitee/sop/servercommon/manager/RequestMappingEvent.java
  7. 4
      sop-server-common/src/main/java/com/gitee/sop/servercommon/message/ServiceErrorEnum.java
  8. 6
      sop-server-common/src/main/java/com/gitee/sop/servercommon/result/ServiceResultBuilder.java
  9. 4
      sop-story/sop-story-web/src/main/java/com/gitee/sop/bookweb/message/StoryErrorEnum.java

@ -17,10 +17,26 @@ public abstract class BaseZuulFilter extends ZuulFilter {
private Integer filterOrder;
/**
* 获取过滤器类型
* @return 返回FilterType
* @see ZuulFilter#filterType() filterType()
*/
protected abstract FilterType getFilterType();
/**
* 获取过滤器顺序
* @return
* @see ZuulFilter#filterOrder() filterOrder()
*/
protected abstract int getFilterOrder();
/**
* 执行run
* @param requestContext
* @return
* @throws ZuulException
*/
protected abstract Object doRun(RequestContext requestContext) throws ZuulException;
/**

@ -7,7 +7,17 @@ import org.springframework.cloud.netflix.zuul.filters.Route;
* @author tanghc
*/
public interface ApiMetaContext {
/**
* 重新加载接口信息
* @param serviceId
* @param serviceApiInfo
*/
void reload(String serviceId, ServiceApiInfo serviceApiInfo);
/**
* 获取接口对应的route信息
* @param nameVersion
* @return
*/
Route getRoute(String nameVersion);
}

@ -4,7 +4,18 @@ package com.gitee.sop.gatewaycommon.result;
* @author tanghc
*/
public interface ResultExecutor {
/**
* 合并结果
* @param responseStatus
* @param responseData
* @return
*/
String mergeResult(int responseStatus, String responseData);
/**
* 合并错误结果
* @param throwable
* @return
*/
String mergeError(Throwable throwable);
}

@ -7,6 +7,7 @@ public interface SignEncipher {
/**
* 签名的摘要算法
* @param input 待签名数据
* @param secret 秘钥
* @return 返回加密后的数据
*/
byte[] encrypt(String input, String secret);

@ -8,5 +8,9 @@ import com.gitee.sop.servercommon.bean.ServiceApiInfo;
public interface ApiMetaManager {
String API_STORE_KEY = "com.gitee.sop.api";
/**
* 上传API
* @param serviceApiInfo
*/
void uploadApi(ServiceApiInfo serviceApiInfo);
}

@ -6,5 +6,9 @@ import com.gitee.sop.servercommon.mapping.ApiMappingHandlerMapping;
* @author tanghc
*/
public interface RequestMappingEvent {
/**
* 注册成功后回调
* @param apiMappingHandlerMapping
*/
void onRegisterSuccess(ApiMappingHandlerMapping apiMappingHandlerMapping);
}

@ -10,8 +10,8 @@ public enum ServiceErrorEnum {
;
private ServiceErrorMeta errorMeta;
ServiceErrorEnum(String sub_code) {
this.errorMeta = new ServiceErrorMeta("isp.error_", sub_code);
ServiceErrorEnum(String subCode) {
this.errorMeta = new ServiceErrorMeta("isp.error_", subCode);
}
public ServiceErrorMeta getErrorMeta() {

@ -8,11 +8,11 @@ import javax.servlet.http.HttpServletResponse;
*/
public interface ServiceResultBuilder {
/**
* 构建错误返回结果
*
* @param throwable 异常
* @param request
* @param response
* @param throwable
* @return 返回最终结果
*/
Object buildError(HttpServletRequest request, HttpServletResponse response, Throwable throwable);

@ -11,8 +11,8 @@ public enum StoryErrorEnum {
;
private ServiceErrorMeta errorMeta;
StoryErrorEnum(String sub_code) {
this.errorMeta = new ServiceErrorMeta("isp.error_", sub_code);
StoryErrorEnum(String subCode) {
this.errorMeta = new ServiceErrorMeta("isp.error_", subCode);
}
public ServiceErrorMeta getErrorMeta() {

Loading…
Cancel
Save