diff --git a/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java b/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java
index 8111617fa3..0ff53d061c 100644
--- a/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java
+++ b/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java
@@ -102,6 +102,22 @@ public class StatViewServlet extends HttpServlet {
return;
}
+ if (path.startsWith("/connectionInfo-")) {
+ Integer id = StringUtils.subStringToInteger(path, "connectionInfo-", ".");
+ DruidDataSource datasource = getDruidDataSourceById(id);
+
+ if (path.endsWith(".json")) {
+ if (datasource == null) returnJSONResult(request, response, RESULT_CODE_ERROR, null);
+ else returnJSONResult(request, response, RESULT_CODE_SUCCESS, datasource.getPoolingConnectionInfo());
+ return;
+ }
+
+ if (path.endsWith(".html")) {
+ returnViewConnectionInfo(datasource, request, response);
+ return;
+ }
+ }
+
if (path.startsWith("/activeConnectionStackTrace-")) {
Integer id = StringUtils.subStringToInteger(path, "activeConnectionStackTrace-", ".");
DruidDataSource datasource = getDruidDataSourceById(id);
@@ -119,6 +135,7 @@ public class StatViewServlet extends HttpServlet {
if (path.startsWith("/sql-")) {
Integer id = StringUtils.subStringToInteger(path, "sql-", ".");
+
if (path.endsWith(".json")) {
Object result = getSqlStatData(id);
returnJSONResult(request, response, result == null ? RESULT_CODE_ERROR : RESULT_CODE_SUCCESS, result);
@@ -161,6 +178,15 @@ public class StatViewServlet extends HttpServlet {
response.getWriter().print(text);
}
+ private void returnViewConnectionInfo(DruidDataSource datasource, HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ if (datasource == null) return;
+
+ String text = IOUtils.readFromResource(RESOURCE_PATH + "/connectionInfo.html");
+ text = text.replaceAll("\\{datasourceId\\}", String.valueOf(System.identityHashCode(datasource)));
+ response.getWriter().print(text);
+ }
+
private void returnViewSqlStat(JdbcSqlStat sqlStat, HttpServletResponse response) throws IOException {
if (sqlStat == null) return;
diff --git a/src/main/resources/support/http/resources/activeConnectionStackTrace.html b/src/main/resources/support/http/resources/activeConnectionStackTrace.html
index 3c73713d64..24081be637 100644
--- a/src/main/resources/support/http/resources/activeConnectionStackTrace.html
+++ b/src/main/resources/support/http/resources/activeConnectionStackTrace.html
@@ -3,9 +3,9 @@
Druid ActiveConnection StackTrace
-
-
-
+
+
+
+
+
diff --git a/src/main/resources/support/http/resources/connectionInfo.html b/src/main/resources/support/http/resources/connectionInfo.html
new file mode 100644
index 0000000000..52e55b681d
--- /dev/null
+++ b/src/main/resources/support/http/resources/connectionInfo.html
@@ -0,0 +1,52 @@
+
+
+
+ Druid SqlStat
+
+
+
+
+
+
+
+
+
+
+
+
Pooling Connection Info List for Datasource {datasourceId}[View JSON API]
+
+
+
+ | ID |
+ Use Count |
+ Last ActiveTime |
+ ConnectTime |
+ Holdability |
+ Transaction Isolation |
+ AutoCommit |
+ ReadoOnly |
+
+ Pscache
+
+
+ | sql |
+ default Row Pretch |
+ row Prefetch |
+ hit Count |
+
+
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/support/http/resources/style.css b/src/main/resources/support/http/resources/css/style.css
similarity index 100%
rename from src/main/resources/support/http/resources/style.css
rename to src/main/resources/support/http/resources/css/style.css
diff --git a/src/main/resources/support/http/resources/datasource.html b/src/main/resources/support/http/resources/datasource.html
index 6e5b47f54c..059833a02b 100644
--- a/src/main/resources/support/http/resources/datasource.html
+++ b/src/main/resources/support/http/resources/datasource.html
@@ -3,9 +3,9 @@
Druid DataSourceStat
-
-
-
+
+
+
-
+
+
+
-
+
+
+
+