This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 66b5d65df [KYUUBI #4982][UI] Add query string to forward requests to 
Engine UI
66b5d65df is described below

commit 66b5d65df6a0cb0ec34e9942199f71b43e0f5fde
Author: hezhao2 <[email protected]>
AuthorDate: Sun Jun 25 14:15:49 2023 +0800

    [KYUUBI #4982][UI] Add query string to forward requests to Engine UI
    
    ### _Why are the changes needed?_
    
    close #4982
    
    The `targetURL` should include the query string so that kyuubi server can 
forward request to right page, eg:
    
    ```
    
/engine-ui/spark-43efae88d766226a-driver-svc.kyuubi-dlssjc-canned.svc:4045/jobs/job/?id=4
    ```
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    Closes #4983 from zhaohehuhu/Improvement-4982.
    
    Closes #4982
    
    9140a8a82 [Cheng Pan] simple
    3140bd9be [Cheng Pan] Update 
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala
    421152268 [hezhao2] refactor the logic of append
    892c5511e [hezhao2] add queryString as job suffix
    53f1ce4b6 [hezhao2] [Improvement] [UI] Add query string to forward requests 
to Engine UI
    
    Lead-authored-by: hezhao2 <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala
index 65fc04f58..021a2ad85 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/EngineUIProxyServlet.scala
@@ -20,6 +20,7 @@ package org.apache.kyuubi.server.api
 import java.net.URL
 import javax.servlet.http.HttpServletRequest
 
+import org.apache.commons.lang3.StringUtils
 import org.eclipse.jetty.client.api.Request
 import org.eclipse.jetty.proxy.ProxyServlet
 
@@ -39,7 +40,9 @@ private[api] class EngineUIProxyServlet extends ProxyServlet 
with Logging {
         case "" | "/" => "/jobs/"
         case path => path
       }
-      targetURL = new URL("http", host, port, targetURI).toString
+      val targetQueryString =
+        Option(request.getQueryString).filter(StringUtils.isNotEmpty).map(q => 
s"?$q").getOrElse("")
+      targetURL = new URL("http", host, port, targetURI + 
targetQueryString).toString
     }
     debug(s"rewrite $requestURL => $targetURL")
     targetURL

Reply via email to