This commit is contained in:
@@ -124,7 +124,7 @@
|
|||||||
</services>
|
</services>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
REST的核心配置项, 存在[rest]节点则Server启动时会加载REST服务, 当Server为SNCP协议时,则SncpServer会变成REST的HttpServer
|
REST的核心配置项, 存在[rest]节点则Server启动时会加载REST服务, 当Server为SNCP协议时,则SncpServer会变成REST的HttpServer, 节点可以多个
|
||||||
base: REST服务的BaseServlet,必须是 org.redkale.net.http.RestHttpServlet 的子类,该属性值默认值为 org.redkale.net.http.DefaultRestServlet。
|
base: REST服务的BaseServlet,必须是 org.redkale.net.http.RestHttpServlet 的子类,该属性值默认值为 org.redkale.net.http.DefaultRestServlet。
|
||||||
autoload:默认值"true" 默认值. 加载当前server所能使用的Servce对象;
|
autoload:默认值"true" 默认值. 加载当前server所能使用的Servce对象;
|
||||||
mustsign:默认值"true" 是否只加载标记为RestService的Service类,默认只加载标记RestService且ignore=false的Service
|
mustsign:默认值"true" 是否只加载标记为RestService的Service类,默认只加载标记RestService且ignore=false的Service
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
ss.add(new AbstractMap.SimpleEntry<>(clazz.getName(), mappings));
|
ss.add(new AbstractMap.SimpleEntry<>(clazz.getName(), mappings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ss != null) {
|
if (ss != null && sb != null) {
|
||||||
Collections.sort(ss, (AbstractMap.SimpleEntry<String, String[]> o1, AbstractMap.SimpleEntry<String, String[]> o2) -> o1.getKey().compareTo(o2.getKey()));
|
Collections.sort(ss, (AbstractMap.SimpleEntry<String, String[]> o1, AbstractMap.SimpleEntry<String, String[]> o2) -> o1.getKey().compareTo(o2.getKey()));
|
||||||
int max = 0;
|
int max = 0;
|
||||||
for (AbstractMap.SimpleEntry<String, String[]> as : ss) {
|
for (AbstractMap.SimpleEntry<String, String[]> as : ss) {
|
||||||
@@ -142,13 +142,15 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb != null && sb.length() > 0) logger.log(Level.INFO, sb.toString());
|
if (sb != null && sb.length() > 0) logger.log(Level.INFO, sb.toString());
|
||||||
if (rest) loadRestServlet(servletsConf);
|
if (rest && serverConf != null) {
|
||||||
|
for (AnyValue restConf : serverConf.getAnyValues("rest")) {
|
||||||
|
loadRestServlet(prefix, restConf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadRestServlet(final AnyValue servletsConf) throws Exception {
|
protected void loadRestServlet(final String prefix, final AnyValue restConf) throws Exception {
|
||||||
if (!rest) return;
|
if (!rest) return;
|
||||||
final String prefix = servletsConf == null ? "" : servletsConf.getValue("path", "");
|
|
||||||
AnyValue restConf = serverConf == null ? null : serverConf.getAnyValue("rest");
|
|
||||||
if (restConf == null) return; //不存在REST服务
|
if (restConf == null) return; //不存在REST服务
|
||||||
final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
|
final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
|
||||||
final String threadName = "[" + Thread.currentThread().getName() + "] ";
|
final String threadName = "[" + Thread.currentThread().getName() + "] ";
|
||||||
|
|||||||
Reference in New Issue
Block a user