[ 
https://issues.apache.org/jira/browse/KNOX-2259?focusedWorklogId=400285&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-400285
 ]

ASF GitHub Bot logged work on KNOX-2259:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Mar/20 18:25
            Start Date: 09/Mar/20 18:25
    Worklog Time Spent: 10m 
      Work Description: smolnar82 commented on pull request #282: KNOX-2259 
KNOX-2260 KNOX-2261 - Fixed Impala/Kudu/HBase UI context path in service 
metadata
URL: https://github.com/apache/knox/pull/282#discussion_r389879022
 
 

 ##########
 File path: 
gateway-service-metadata/src/main/java/org/apache/knox/gateway/service/metadata/ServiceModel.java
 ##########
 @@ -101,14 +103,27 @@ public String getContext() {
   }
 
   @XmlElement
-  public String getServiceUrl() {
+  public String getServiceUrl() throws MalformedURLException {
     String context = getContext();
     if ("HIVE".equals(getServiceName())) {
       return String.format(Locale.ROOT, 
"jdbc:hive2://%s:%d/;?hive.server2.transport.mode=http;hive.server2.thrift.http.path=/%s/%s%s",
 request.getServerName(),
           request.getServerPort(), gatewayPath, topologyName, context);
     } else {
+      final String backendUrlString = getBackendServiceUrl();
       if (context.indexOf("{{BACKEND_HOST}}") > -1) {
-        context = context.replace("{{BACKEND_HOST}}", getBackendServiceUrl());
+        context = context.replace("{{BACKEND_HOST}}", backendUrlString);
+      }
+      if (context.indexOf("{{SCHEME}}") > -1 || context.indexOf("{{HOST}}") > 
-1 || context.indexOf("{{PORT}}") > -1) {
+        final URL backendUrl = new URL(backendUrlString);
+        if (context.indexOf("{{SCHEME}}") > -1) {
+          context = context.replace("{{SCHEME}}", backendUrl.getProtocol());
+        }
+        if (context.indexOf("{{HOST}}") > -1) {
+          context = context.replace("{{HOST}}", backendUrl.getHost());
+        }
+        if (context.indexOf("{{PORT}}") > -1) {
+          context = context.replace("{{PORT}}", 
String.valueOf(backendUrl.getPort()));
+        }
 
 Review comment:
   Fixed; I'll wait till Travis finishes and merge this one.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 400285)
    Time Spent: 40m  (was: 0.5h)

> Fix context path for Impala UI in service.xml
> ---------------------------------------------
>
>                 Key: KNOX-2259
>                 URL: https://issues.apache.org/jira/browse/KNOX-2259
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.4.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 1.4.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Impala UI redirect follows the following pattern:
> {code}
> KNOX_GATEWAY_URL/GATEWAY_PATH/TOPOLOGY/impalaui?scheme=SCHEME&host=HOSTNAME&port=PORT
> {code}
> This needs to be reflected in Impala UI's service definition.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to