node-web-mvc
Version:
node spring mvc
66 lines (65 loc) • 2.63 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_RESOURCE_MIME_TYPES = void 0;
const path_1 = __importDefault(require("path"));
const Bytes_1 = __importDefault(require("../util/Bytes"));
const ApplicationContextAware_1 = __importDefault(require("../context/ApplicationContextAware"));
exports.DEFAULT_RESOURCE_MIME_TYPES = 'application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain';
class WebAppConfigurerOptions extends ApplicationContextAware_1.default {
// 注册拦截器
addInterceptors(registry) { }
// 添加视图解析器
configureViewResolvers(registry) { }
// 添加返回值处理器
addReturnValueHandlers(handlers) { }
// 配置消息转换器
configureMessageConverters(converters) { }
// 添加http消息转换器
extendMessageConverters(converters) { }
// 添加参数解析器
addArgumentResolvers(resolvers) { }
// 添加静态资源处理器
addResourceHandlers(registry) { }
// 提供扩展配置路径匹配相关
configurePathMatch(configurer) { }
// 配置异常解析器 可用于取代默认的解析器
configureHandlerExceptionResolvers(resolvers) { }
// 扩展异常处理器
extendHandlerExceptionResolvers(resolvers) { }
// 全局配置跨域
addCorsMappings(registry) { }
/**
* 设置的application context
* @param context
*/
setApplication(context) {
this.applicationContext = context;
}
constructor(a) {
super();
const options = a || {};
this.resource = options.resource;
this.multipart = options.multipart || { maxFileSize: '', maxRequestSize: '' };
this.multipart.maxFileSize = new Bytes_1.default(this.multipart.maxFileSize, '500kb').bytes;
this.multipart.maxRequestSize = new Bytes_1.default(this.multipart.maxRequestSize, '500kb').bytes;
const tmpRoot = this.multipart.mediaRoot || 'app_data/media';
if (!path_1.default.isAbsolute(tmpRoot)) {
this.multipart.mediaRoot = path_1.default.resolve(tmpRoot);
}
else {
this.multipart.mediaRoot = tmpRoot;
}
if (a) {
Object.keys(a).forEach((k) => {
const handler = a[k];
if (typeof handler == 'function') {
this[k] = handler;
}
});
}
}
}
exports.default = WebAppConfigurerOptions;