DispatcherServlet

This commit is contained in:
redkale
2024-01-04 22:23:16 +08:00
parent 6348aa884f
commit 503c2c6f72
3 changed files with 1 additions and 11 deletions

View File

@@ -149,7 +149,6 @@
aliveTimeoutSeconds: KeepAlive读操作超时秒数 默认30 0表示永久不超时; -1表示禁止KeepAlive
readTimeoutSeconds: 读操作超时秒数, 默认0 0表示永久不超时
writeTimeoutSeconds: 写操作超时秒数, 默认0 0表示永久不超时
dispatcher: DispatcherServlet的自定义实现类若是HttpServer则实现类必须是HttpDispatcherServlet的子类
interceptor: 启动/关闭NodeServer时被调用的拦截器实现类必须是org.redkale.boot.NodeInterceptor的子类默认为null
-->
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">

View File

@@ -160,7 +160,6 @@
aliveTimeoutSeconds: KeepAlive读操作超时秒数 默认30 0表示永久不超时; -1表示禁止KeepAlive
readTimeoutSeconds: 读操作超时秒数, 默认0 0表示永久不超时
writeTimeoutSeconds: 写操作超时秒数, 默认0 0表示永久不超时
dispatcher: DispatcherServlet的自定义实现类若是HttpServer则实现类必须是HttpDispatcherServlet的子类
interceptor: 启动/关闭NodeServer时被调用的拦截器实现类必须是org.redkale.boot.NodeInterceptor的子类默认为null
-->
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">

View File

@@ -57,7 +57,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
protected final ResourceFactory resourceFactory;
//服务的根Servlet
protected DispatcherServlet<K, C, R, P, S> dispatcher;
protected final DispatcherServlet<K, C, R, P, S> dispatcher;
//ClassLoader
protected RedkaleClassLoader serverClassLoader;
@@ -138,14 +138,6 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
if (!this.name.matches("^[a-zA-Z][\\w_-]{1,64}$")) {
throw new RedkaleException("server.name (" + this.name + ") is illegal");
}
String dispatcherImpl = config.getValue("dispatcher");
if (Utility.isNotBlank(dispatcherImpl)) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Class dispatcherImplClass = classLoader.loadClass(dispatcherImpl);
RedkaleClassLoader.putReflectionDeclaredConstructors(dispatcherImplClass, dispatcherImplClass.getName());
this.dispatcher = (DispatcherServlet) dispatcherImplClass.getConstructors()[0].newInstance();
this.dispatcher.application = application;
}
AnyValue sslConf = config.getAnyValue("ssl");
if (sslConf != null) {
String builderClass = sslConf.getValue("builder", SSLBuilder.class.getName());