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

@@ -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());