diff --git a/webserver/src/main/kotlin/net/corda/webserver/internal/NodeWebServer.kt b/webserver/src/main/kotlin/net/corda/webserver/internal/NodeWebServer.kt index 33dd19ea46..085142d13f 100644 --- a/webserver/src/main/kotlin/net/corda/webserver/internal/NodeWebServer.kt +++ b/webserver/src/main/kotlin/net/corda/webserver/internal/NodeWebServer.kt @@ -24,10 +24,8 @@ import org.slf4j.LoggerFactory import java.io.IOException import java.io.Writer import java.lang.reflect.InvocationTargetException -import java.util.ServiceLoader -import javax.servlet.http.HttpServlet +import java.util.* import javax.servlet.http.HttpServletRequest -import javax.servlet.http.HttpServletResponse import javax.ws.rs.core.MediaType class NodeWebServer(val config: WebServerConfig) { @@ -160,7 +158,13 @@ class NodeWebServer(val config: WebServerConfig) { resourceConfig.addProperties(mapOf(ServerProperties.APPLICATION_NAME to "node.api", ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED to "true")) - val infoServlet = ServletHolder(CorDappInfoServlet(pluginRegistries, localRpc)) + val filteredPlugins = pluginRegistries.filterNot { + it.javaClass.name.startsWith("net.corda.node.") || + it.javaClass.name.startsWith("net.corda.core.") || + it.javaClass.name.startsWith("net.corda.nodeapi.") + } + + val infoServlet = ServletHolder(CorDappInfoServlet(filteredPlugins, localRpc)) addServlet(infoServlet, "") val container = ServletContainer(resourceConfig) diff --git a/webserver/src/main/kotlin/net/corda/webserver/servlets/CorDappInfoServlet.kt b/webserver/src/main/kotlin/net/corda/webserver/servlets/CorDappInfoServlet.kt index 3583498abf..48c7836d04 100644 --- a/webserver/src/main/kotlin/net/corda/webserver/servlets/CorDappInfoServlet.kt +++ b/webserver/src/main/kotlin/net/corda/webserver/servlets/CorDappInfoServlet.kt @@ -23,36 +23,40 @@ class CorDappInfoServlet(val plugins: List<CordaPluginRegistry>, val rpc: CordaR } body { h2 { +"Installed CorDapps" } - plugins.forEach { plugin -> - h3 { +plugin::class.java.name } - if (plugin.requiredFlows.isNotEmpty()) { - div { - p { +"Whitelisted flows:" } - ul { - plugin.requiredFlows.map { it.key }.forEach { li { +it } } + if (plugins.isEmpty()) { + p { +"No installed custom CorDapps." } + } else { + plugins.forEach { plugin -> + h3 { +plugin::class.java.name } + if (plugin.requiredFlows.isNotEmpty()) { + div { + p { +"Whitelisted flows:" } + ul { + plugin.requiredFlows.map { it.key }.forEach { li { +it } } + } } } - } - if (plugin.webApis.isNotEmpty()) { - div { - plugin.webApis.forEach { api -> - val resource = Resource.from(api.apply(rpc)::class.java) - p { +"${resource.name}:" } - val endpoints = processEndpoints("", resource, mutableListOf<Endpoint>()) - ul { - endpoints.forEach { - li { a(it.uri) { +"${it.method}\t${it.text}" } } + if (plugin.webApis.isNotEmpty()) { + div { + plugin.webApis.forEach { api -> + val resource = Resource.from(api.apply(rpc)::class.java) + p { +"${resource.name}:" } + val endpoints = processEndpoints("", resource, mutableListOf<Endpoint>()) + ul { + endpoints.forEach { + li { a(it.uri) { +"${it.method}\t${it.text}" } } + } } } } } - } - if (plugin.staticServeDirs.isNotEmpty()) { - div { - p { +"Static web content:" } - ul { - plugin.staticServeDirs.map { it.key }.forEach { - li { a("web/$it") { +it } } + if (plugin.staticServeDirs.isNotEmpty()) { + div { + p { +"Static web content:" } + ul { + plugin.staticServeDirs.map { it.key }.forEach { + li { a("web/$it") { +it } } + } } } }