@ -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
* @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
Route getRoute(String nameVersion);
}
@ -4,7 +4,18 @@ package com.gitee.sop.gatewaycommon.result;
public interface ResultExecutor {
* 合并结果
* @param responseStatus
* @param responseData
String mergeResult(int responseStatus, String responseData);
* 合并错误结果
* @param throwable
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
void uploadApi(ServiceApiInfo serviceApiInfo);
@ -6,5 +6,9 @@ import com.gitee.sop.servercommon.mapping.ApiMappingHandlerMapping;
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
* @return 返回最终结果
Object buildError(HttpServletRequest request, HttpServletResponse response, Throwable throwable);
@ -11,8 +11,8 @@ public enum StoryErrorEnum {
StoryErrorEnum(String sub_code) {
StoryErrorEnum(String subCode) {