node-web-mvc
Version:
node spring mvc
86 lines (85 loc) • 3.47 kB
TypeScript
/**
* @module AbstractHandlerMapping
* @description 抽象映射处理器
*/
import HandlerMapping from './HandlerMapping';
import HandlerExecutionChain from '../interceptor/HandlerExecutionChain';
import ServletContext from '../http/ServletContext';
import HandlerInterceptor from '../interceptor/HandlerInterceptor';
import MappedInterceptor from '../interceptor/MappedInterceptor';
import HttpServletRequest from '../http/HttpServletRequest';
import UrlPathHelper from '../util/UrlPathHelper';
import PathMatcher from '../util/PathMatcher';
import ApplicationContextAware from '../context/ApplicationContextAware';
import AbstractApplicationContext from '../context/AbstractApplicationContext';
import Ordered from '../context/Ordered';
import CorsConfigurationSource from '../cors/CorsConfigurationSource';
import CorsProcessor from '../cors/CorsProcessor';
import CorsConfiguration from '../cors/CorsConfiguration';
export default abstract class AbstractHandlerMapping extends ApplicationContextAware implements HandlerMapping, Ordered {
protected urlPathHelper: UrlPathHelper;
protected pathMatcher: PathMatcher;
protected interceptors: HandlerInterceptor[];
protected appContext: AbstractApplicationContext;
protected corsConfigurationSource: CorsConfigurationSource;
private order;
get corsProcessor(): CorsProcessor;
set corsProcessor(value: CorsProcessor);
constructor();
setUrlPathHelper(value: UrlPathHelper): void;
setPathMatcher(value: PathMatcher): void;
/**
* 所有设置的拦截器
*/
setInterceptors(interceptors: HandlerInterceptor[]): void;
private defaultHandler;
/**
* 从 this.interceptors 适配后拦截器
* 由于在框架中,暂时不需要适配,所以直接返回this.interceptors
*/
get adaptedInterceptors(): Array<HandlerInterceptor>;
/**
* 获取类型为匹配型拦截器列表
*/
get mappedInterceptors(): Array<MappedInterceptor>;
/**
* 设置当前默认处理器
* @param handler 处理器
*/
setDefaultHandler(handler: any): void;
/**
* 获取当前默认处理器
*/
getDefaultHandler(): any;
/**
* 判断,当前是否使用路径匹配
* 暂时:不使用
*/
usesPathPatterns(): boolean;
/**
* 扩展拦截器,主要用于子类使用。
*/
protected extendInterceptors(): void;
setApplication(context: AbstractApplicationContext): void;
/**
* 根据当前请求对象获取 处理器执行链
* @param context 请求上下文对象
*/
getHandler(context: ServletContext): HandlerExecutionChain;
/**
* 根据当前request请求对象,获取对应的处理器
*/
protected abstract getHandlerInternal(context: ServletContext): object;
protected initLookupPath(request: HttpServletRequest): string;
/**
* 根据当前请求对应的处理器handler来获取对应的 拦截器执行链
*/
protected getHandlerExecutionChain(handler: object, context: ServletContext): HandlerExecutionChain;
getOrder(): number;
setOrder(value: number): number;
private findCorsConfigurationSource;
private getCorsHandlerExecutionChain;
hasCorsConfigurationSource(handler: object): boolean;
getCorsConfiguration(handler: object, request: HttpServletRequest): CorsConfiguration;
setCorsConfigurations(config: Map<string, CorsConfiguration>): void;
}