Merge remote-tracking branch 'upstream/master'

This commit is contained in:
wenshao
2013-04-05 01:34:29 +08:00
5 changed files with 115 additions and 95 deletions
@@ -123,10 +123,10 @@ public class PagerUtils {
}
OracleSelectQueryBlock countQueryBlock = new OracleSelectQueryBlock();
countQueryBlock.getSelectList().add(new SQLSelectItem(new SQLPropertyExpr(new SQLIdentifierExpr("_X"), "*")));
countQueryBlock.getSelectList().add(new SQLSelectItem(new SQLIdentifierExpr("ROWNUM"), "_RN"));
countQueryBlock.getSelectList().add(new SQLSelectItem(new SQLPropertyExpr(new SQLIdentifierExpr("XX"), "*")));
countQueryBlock.getSelectList().add(new SQLSelectItem(new SQLIdentifierExpr("ROWNUM"), "RN"));
countQueryBlock.setFrom(new SQLSubqueryTableSource(select, "_X"));
countQueryBlock.setFrom(new SQLSubqueryTableSource(select, "XX"));
countQueryBlock.setWhere(new SQLBinaryOpExpr(new SQLIdentifierExpr("ROWNUM"), //
SQLBinaryOperator.LessThanOrEqual, //
new SQLNumberExpr(count + offset)));
@@ -136,8 +136,8 @@ public class PagerUtils {
OracleSelectQueryBlock offsetQueryBlock = new OracleSelectQueryBlock();
offsetQueryBlock.getSelectList().add(new SQLSelectItem(new SQLAllColumnExpr()));
offsetQueryBlock.setFrom(new SQLSubqueryTableSource(new SQLSelect(countQueryBlock), "_XX"));
offsetQueryBlock.setWhere(new SQLBinaryOpExpr(new SQLIdentifierExpr("_RN"), //
offsetQueryBlock.setFrom(new SQLSubqueryTableSource(new SQLSelect(countQueryBlock), "XXX"));
offsetQueryBlock.setWhere(new SQLBinaryOpExpr(new SQLIdentifierExpr("RN"), //
SQLBinaryOperator.GreaterThan, //
new SQLNumberExpr(offset)));
@@ -120,6 +120,17 @@ public final class DruidStatService implements DruidStatServiceMBean {
if (url.startsWith("/sql.json")) {
return returnJSONResult(RESULT_CODE_SUCCESS, getSqlStatDataList(parameters));
}
if (url.startsWith("/wall.json")) {
Object result = statManagerFacade.getWallStatMap(null);
return returnJSONResult(RESULT_CODE_SUCCESS, result);
}
if (url.startsWith("/wall-") && url.indexOf(".json") > 0) {
Integer dataSourceId = StringUtils.subStringToInteger(url, "wall-", ".json");
Object result = statManagerFacade.getWallStatMap(dataSourceId);
return returnJSONResult(result == null ? RESULT_CODE_ERROR : RESULT_CODE_SUCCESS, result);
}
if (url.startsWith("/sql-") && url.indexOf(".json") > 0) {
Integer id = StringUtils.subStringToInteger(url, "sql-", ".json");
@@ -348,10 +348,10 @@ public class StatViewServlet extends HttpServlet {
if (isRequireAuth()
&& session.getAttribute(SESSION_USER_KEY) == null
&& !("/login.html".equals(path) || path.startsWith("/css") || path.startsWith("/js") || path.startsWith("/img"))) {
if (contextPath == null || contextPath.equals("") || contextPath.equals("/")) {
response.sendRedirect("/login.html");
if (contextPath == null || contextPath.equals("") || contextPath.equals("/")) {
response.sendRedirect("/druid/login.html");
} else {
response.sendRedirect("login.html");
response.sendRedirect("druid/login.html");
}
return;
}