[
https://issues.apache.org/jira/browse/KNOX-2259?focusedWorklogId=400122&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-400122
]
ASF GitHub Bot logged work on KNOX-2259:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Mar/20 13:55
Start Date: 09/Mar/20 13:55
Worklog Time Spent: 10m
Work Description: risdenk 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_r389693686
##########
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:
Not sure we need all the double checks? Can't we just do
`context.replace(...)` and if it doesn't match it won't replace? The strings
here are super short. It might even be slower to do a check and then replace
anyway.
----------------------------------------------------------------
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: 400122)
Time Spent: 20m (was: 10m)
> 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: 20m
> 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)