mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
init
This commit is contained in:
@@ -17,10 +17,26 @@ public abstract class BaseZuulFilter extends ZuulFilter {
|
|||||||
|
|
||||||
private Integer filterOrder;
|
private Integer filterOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取过滤器类型
|
||||||
|
* @return 返回FilterType
|
||||||
|
* @see ZuulFilter#filterType() filterType()
|
||||||
|
*/
|
||||||
protected abstract FilterType getFilterType();
|
protected abstract FilterType getFilterType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取过滤器顺序
|
||||||
|
* @return
|
||||||
|
* @see ZuulFilter#filterOrder() filterOrder()
|
||||||
|
*/
|
||||||
protected abstract int getFilterOrder();
|
protected abstract int getFilterOrder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行run
|
||||||
|
* @param requestContext
|
||||||
|
* @return
|
||||||
|
* @throws ZuulException
|
||||||
|
*/
|
||||||
protected abstract Object doRun(RequestContext requestContext) throws ZuulException;
|
protected abstract Object doRun(RequestContext requestContext) throws ZuulException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -7,7 +7,17 @@ import org.springframework.cloud.netflix.zuul.filters.Route;
|
|||||||
* @author tanghc
|
* @author tanghc
|
||||||
*/
|
*/
|
||||||
public interface ApiMetaContext {
|
public interface ApiMetaContext {
|
||||||
|
/**
|
||||||
|
* 重新加载接口信息
|
||||||
|
* @param serviceId
|
||||||
|
* @param serviceApiInfo
|
||||||
|
*/
|
||||||
void reload(String serviceId, ServiceApiInfo serviceApiInfo);
|
void reload(String serviceId, ServiceApiInfo serviceApiInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取接口对应的route信息
|
||||||
|
* @param nameVersion
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Route getRoute(String nameVersion);
|
Route getRoute(String nameVersion);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,18 @@ package com.gitee.sop.gatewaycommon.result;
|
|||||||
* @author tanghc
|
* @author tanghc
|
||||||
*/
|
*/
|
||||||
public interface ResultExecutor {
|
public interface ResultExecutor {
|
||||||
|
/**
|
||||||
|
* 合并结果
|
||||||
|
* @param responseStatus
|
||||||
|
* @param responseData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
String mergeResult(int responseStatus, String responseData);
|
String mergeResult(int responseStatus, String responseData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并错误结果
|
||||||
|
* @param throwable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
String mergeError(Throwable throwable);
|
String mergeError(Throwable throwable);
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ public interface SignEncipher {
|
|||||||
/**
|
/**
|
||||||
* 签名的摘要算法
|
* 签名的摘要算法
|
||||||
* @param input 待签名数据
|
* @param input 待签名数据
|
||||||
|
* @param secret 秘钥
|
||||||
* @return 返回加密后的数据
|
* @return 返回加密后的数据
|
||||||
*/
|
*/
|
||||||
byte[] encrypt(String input, String secret);
|
byte[] encrypt(String input, String secret);
|
||||||
|
@@ -8,5 +8,9 @@ import com.gitee.sop.servercommon.bean.ServiceApiInfo;
|
|||||||
public interface ApiMetaManager {
|
public interface ApiMetaManager {
|
||||||
String API_STORE_KEY = "com.gitee.sop.api";
|
String API_STORE_KEY = "com.gitee.sop.api";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传API
|
||||||
|
* @param serviceApiInfo
|
||||||
|
*/
|
||||||
void uploadApi(ServiceApiInfo serviceApiInfo);
|
void uploadApi(ServiceApiInfo serviceApiInfo);
|
||||||
}
|
}
|
||||||
|
@@ -6,5 +6,9 @@ import com.gitee.sop.servercommon.mapping.ApiMappingHandlerMapping;
|
|||||||
* @author tanghc
|
* @author tanghc
|
||||||
*/
|
*/
|
||||||
public interface RequestMappingEvent {
|
public interface RequestMappingEvent {
|
||||||
|
/**
|
||||||
|
* 注册成功后回调
|
||||||
|
* @param apiMappingHandlerMapping
|
||||||
|
*/
|
||||||
void onRegisterSuccess(ApiMappingHandlerMapping apiMappingHandlerMapping);
|
void onRegisterSuccess(ApiMappingHandlerMapping apiMappingHandlerMapping);
|
||||||
}
|
}
|
||||||
|
@@ -10,8 +10,8 @@ public enum ServiceErrorEnum {
|
|||||||
;
|
;
|
||||||
private ServiceErrorMeta errorMeta;
|
private ServiceErrorMeta errorMeta;
|
||||||
|
|
||||||
ServiceErrorEnum(String sub_code) {
|
ServiceErrorEnum(String subCode) {
|
||||||
this.errorMeta = new ServiceErrorMeta("isp.error_", sub_code);
|
this.errorMeta = new ServiceErrorMeta("isp.error_", subCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceErrorMeta getErrorMeta() {
|
public ServiceErrorMeta getErrorMeta() {
|
||||||
|
@@ -8,11 +8,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
*/
|
*/
|
||||||
public interface ServiceResultBuilder {
|
public interface ServiceResultBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建错误返回结果
|
* 构建错误返回结果
|
||||||
*
|
* @param request
|
||||||
* @param throwable 异常
|
* @param response
|
||||||
|
* @param throwable
|
||||||
* @return 返回最终结果
|
* @return 返回最终结果
|
||||||
*/
|
*/
|
||||||
Object buildError(HttpServletRequest request, HttpServletResponse response, Throwable throwable);
|
Object buildError(HttpServletRequest request, HttpServletResponse response, Throwable throwable);
|
||||||
|
@@ -11,8 +11,8 @@ public enum StoryErrorEnum {
|
|||||||
;
|
;
|
||||||
private ServiceErrorMeta errorMeta;
|
private ServiceErrorMeta errorMeta;
|
||||||
|
|
||||||
StoryErrorEnum(String sub_code) {
|
StoryErrorEnum(String subCode) {
|
||||||
this.errorMeta = new ServiceErrorMeta("isp.error_", sub_code);
|
this.errorMeta = new ServiceErrorMeta("isp.error_", subCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceErrorMeta getErrorMeta() {
|
public ServiceErrorMeta getErrorMeta() {
|
||||||
|
Reference in New Issue
Block a user