Module initialization and configuration instructions
Module initialization
In the Web program, the listener is the first to be initialized by the container, so the WebMVC module is responsible for initializing the YMP framework by the listener:
Listener: net.ymate.platform.webmvc.support.WebAppEventListener
The process of processing browser requests and matching and routing with controllers in the module can be controlled by filters respectively (Filter) and server program (Servlet) completed:
Filter (Filter): net.ymate.platform.webmvc.support.DispatchFilter
Server program (Servlet) :net.ymate.platform.webmvc.support.DispatchServlet
First look at the complete web.xml configuration file:
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <listener> <listener-class>net.ymate.platform.webmvc.support.WebAppEventListener</listener-class> </listener> <filter> <filter-name>DispatchFilter</filter-name> <filter-class>net.ymate.platform.webmvc.support.DispatchFilter</filter-class> </filter> <filter-mapping> <filter-name>DispatchFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <!-- <servlet> <servlet-name>DispatchServlet</servlet-name> <servlet-class>net.ymate.platform.webmvc.support.DispatchServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>DispatchServlet</servlet-name> <url-pattern>/service/*</url-pattern> </servlet-mapping> --> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
Module configuration
Basic initialization parameter configuration of WebMVC module:
#------------------------------------- # 基本初始化参数 #------------------------------------- # 控制器请求处理器,可选值为已知处理器名称或自定义处理器类名称,自定义类需实现net.ymate.platform.webmvc.IRequestProcessor接口,默认为default,目前支持已知处理器[default|json|xml|...] ymp.configs.webmvc.request_processor_class= # 异常错误处理器,可选参数,此类需实现net.ymate.platform.webmvc.IWebErrorProcessor接口 ymp.configs.webmvc.error_processor_class= # 缓存处理器,可选参数,此类需实现net.ymate.platform.webmvc.IWebCacheProcessor接口 ymp.configs.webmvc.cache_processor_class= # 默认字符编码集设置,可选参数,默认值为UTF-8 ymp.configs.webmvc.default_charset_encoding= # 请求忽略正则表达式,可选参数,默认值为^.+\.(jsp|jspx|png|gif|jpg|jpeg|js|css|swf|ico|htm|html|eot|woff|woff2|ttf|svg)$ ymp.configs.webmvc.request_ignore_regex= # 请求方法参数名称,可选参数, 默认值为_method ymp.configs.webmvc.request_method_param= # 请求路径前缀,可选参数,默认值为空 ymp.configs.webmvc.request_prefix= # 请求参数转义模式是否开启(开启状态时,控制器方法的所有参数将默认支持转义,可针对具体控制器主法或参数设置忽略转义操作),可选参数,默认值为false ymp.configs.webmvc.parameter_escape_mode= # 执行请求参数转义顺序,可选参数,取值范围:before(参数验证之前)和after(参数验证之后),默认值为after ymp.configs.webmvc.parameter_escape_order= # 控制器视图文件基础路径(必须是以 '/' 开始和结尾,默认值为/WEB-INF/templates/) ymp.configs.webmvc.base_view_path=
Description: In the request processing of the server program in Servlet mode, the request ignores the regular expressionrequest_ignore_regex
The parameter is invalid;