node-web-mvc
Version:
node spring mvc
44 lines (43 loc) • 1.77 kB
TypeScript
/**
* @module AbstractHandlerMethodMapping
* @description 抽象请求方法映射
*/
import AbstractHandlerMapping from './AbstractHandlerMapping';
import ServletContext from '../http/ServletContext';
import HttpServletRequest from '../http/HttpServletRequest';
import MappingRegistration from './registry/MappingRegistration';
import HandlerMethod from '../method/HandlerMethod';
import { ClazzType } from '../../interface/declare';
import CorsConfiguration from '../cors/CorsConfiguration';
export default abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMapping {
private readonly registrations;
private readonly corsLookup;
protected abstract match(registraction: MappingRegistration<T>, lookupPath: string, request: HttpServletRequest): HandlerMethod;
constructor();
/**
* 注册一个映射方法
*/
registerHandlerMethod(name: string, mapping: T, handler: any, method: Function): void;
/**
* 移除一个映射方法
* @param mapping
*/
removeHandlerMethod(mapping: T): void;
/**
* 获取所有注册的Mappings
* @returns
*/
getRegistrations(): Map<T, MappingRegistration<T>>;
/**
* 根据请求上下信息,获取用于处理当前请求的处理器.
*/
getHandlerInternal(context: ServletContext): HandlerMethod;
/**
* 根据请求查找对应的HandlerMethod
*/
lookupHandlerMethod(lookupPath: string, request: HttpServletRequest): HandlerMethod;
getMappingForMethod(handler: HandlerMethod): T;
hasCorsConfigurationSource(handler: object): boolean;
getCorsConfiguration(handler: object, request: HttpServletRequest): CorsConfiguration;
initCorsConfiguration(beanType: ClazzType, method: Function): any;
}