From 0d19b9bd0b540b6bd5e1ec701c2eef4b0d3ccd1a Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Fri, 27 Sep 2024 18:25:07 +0530 Subject: [PATCH] HBASE-20693 Refactor thrift jsp's and extract header and footer (#5732) (#5737) - Fixes the way logLevel page renders in UI Signed-off-by: Nick Dimiduk (cherry picked from commit ede4ccd2dc5f5690a518f97b6d28a7e18df9584a) --- .../resources/hbase-webapps/thrift/footer.jsp | 30 +++++++ .../resources/hbase-webapps/thrift/header.jsp | 74 ++++++++++++++++ .../resources/hbase-webapps/thrift/thrift.jsp | 85 ++++--------------- 3 files changed, 121 insertions(+), 68 deletions(-) create mode 100644 hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp create mode 100644 hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp new file mode 100644 index 000000000000..53a7d0cdbdbb --- /dev/null +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp @@ -0,0 +1,30 @@ +<%-- +/** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> + + + + + + diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp new file mode 100644 index 000000000000..f43872c11af6 --- /dev/null +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp @@ -0,0 +1,74 @@ +<%-- +/** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> +<%@ page contentType="text/html;charset=UTF-8" + import="org.apache.hadoop.hbase.HBaseConfiguration"%> + + + + + + + <%= request.getParameter("pageTitle")%> + + + + + + + + + + diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index 6b308fc2a2dc..d148df1f2e29 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -19,7 +19,6 @@ --%> <%@ page contentType="text/html;charset=UTF-8" import="org.apache.hadoop.conf.Configuration" - import="org.apache.hadoop.hbase.HBaseConfiguration" import="org.apache.hadoop.hbase.util.VersionInfo" import="java.util.Date" %> @@ -27,72 +26,25 @@ <%@ page import="org.apache.hadoop.hbase.util.JvmVersion" %> <% -Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); -String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type"); -long startcode = conf.getLong("startcode", System.currentTimeMillis()); -String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); -ImplType implType = ImplType.getServerImpl(conf); + Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); + String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type"); + long startcode = conf.getLong("startcode", System.currentTimeMillis()); + String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); + ImplType implType = ImplType.getServerImpl(conf); -String transport = - (implType.isAlwaysFramed() || - conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard"; -String protocol = - conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary"; -String qop = conf.get("hbase.thrift.security.qop", "None"); + String transport = + (implType.isAlwaysFramed() || + conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard"; + String protocol = + conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary"; + String qop = conf.get("hbase.thrift.security.qop", "None"); + pageContext.setAttribute("pageTitle", "HBase Thrift Server: " + listenPort); %> - - - - - - HBase Thrift Server: <%= listenPort %> - - - - - - - - - + + +
@@ -165,8 +117,5 @@ String qop = conf.get("hbase.thrift.security.qop", "None");
- - - - - + +