This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new d208e95e5b fix resources in hop server, fixes #7115 (#7474)
d208e95e5b is described below
commit d208e95e5bca84ebe234e2987c21fc8937beeee8
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Jul 10 09:17:25 2026 +0200
fix resources in hop server, fixes #7115 (#7474)
---
.../java/org/apache/hop/www/BaseHttpServlet.java | 23 ++++++++++++++++
.../java/org/apache/hop/www/BodyHttpServlet.java | 10 ++++---
.../apache/hop/www/GetPipelineStatusServlet.java | 19 ++++++-------
.../java/org/apache/hop/www/GetRootServlet.java | 5 +++-
.../java/org/apache/hop/www/GetStatusServlet.java | 31 +++++-----------------
.../apache/hop/www/GetWorkflowStatusServlet.java | 21 +++++++--------
.../org/apache/hop/www/PausePipelineServlet.java | 4 ++-
.../hop/www/PrepareExecutionPipelineServlet.java | 5 +++-
.../org/apache/hop/www/RemovePipelineServlet.java | 4 ++-
.../org/apache/hop/www/RemoveWorkflowServlet.java | 4 ++-
.../org/apache/hop/www/SniffTransformServlet.java | 4 ++-
.../hop/www/StartExecutionPipelineServlet.java | 5 +++-
.../org/apache/hop/www/StartPipelineServlet.java | 5 +++-
.../org/apache/hop/www/StartWorkflowServlet.java | 5 +++-
.../org/apache/hop/www/StatusServletUtils.java | 2 --
.../org/apache/hop/www/StopPipelineServlet.java | 4 ++-
.../org/apache/hop/www/GetStatusServletTest.java | 27 +++++++++++++++++++
.../org/apache/hop/www/StatusServletUtilsTest.java | 2 --
18 files changed, 116 insertions(+), 64 deletions(-)
diff --git a/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java
b/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java
index 335281392d..97fb89a4ea 100644
--- a/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/BaseHttpServlet.java
@@ -60,6 +60,29 @@ public class BaseHttpServlet extends HttpServlet {
return contextPath.substring(contextPath.lastIndexOf("/") + 1);
}
+ /**
+ * Returns the location under which the bundled static assets (icons, css)
are served, made
+ * relative to the deployment root. The servlet's own {@code contextPath} is
stripped off the
+ * request URI, so the result is root-based for a root deployment and
carries the servlet
+ * container context path / reverse-proxy prefix otherwise.
+ *
+ * <p>The assets ship at {@link StatusServletUtils#STATIC_PATH} in both the
standalone hop-server
+ * (served on the root Jetty context) and the Hop Web war (unpacked to the
war root), so this
+ * resolves correctly in every deployment - including behind a reverse proxy
- without a
+ * Jetty-vs-servlet-container branch.
+ */
+ protected String getStaticPath(HttpServletRequest request, String
contextPath) {
+ String requestUri = request.getRequestURI();
+ String root = "";
+ if (requestUri != null) {
+ int index = requestUri.indexOf(contextPath);
+ if (index > 0) {
+ root = requestUri.substring(0, index);
+ }
+ }
+ return root + StatusServletUtils.STATIC_PATH;
+ }
+
public BaseHttpServlet() {}
public BaseHttpServlet(PipelineMap pipelineMap) {
diff --git a/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java
b/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java
index c360672703..e1a2d3721c 100644
--- a/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/BodyHttpServlet.java
@@ -75,7 +75,7 @@ public abstract class BodyHttpServlet extends BaseHttpServlet
implements IHopSer
response.setContentType("application/json");
response.setCharacterEncoding(Const.UTF_8);
} else {
- beginHtml(response, out);
+ beginHtml(request, response, out);
}
WebResult result = generateBody(request, response, useXML, variables);
@@ -108,7 +108,8 @@ public abstract class BodyHttpServlet extends
BaseHttpServlet implements IHopSer
}
}
- protected void beginHtml(HttpServletResponse response, PrintWriter out) {
+ protected void beginHtml(
+ HttpServletRequest request, HttpServletResponse response, PrintWriter
out) {
response.setContentType("text/html;charset=UTF-8");
out.println("<HTML>");
out.println("<HEAD>");
@@ -116,7 +117,10 @@ public abstract class BodyHttpServlet extends
BaseHttpServlet implements IHopSer
out.println(Encode.forHtml(getTitle()));
out.println("</TITLE>");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, getContextPath())
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git
a/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java
b/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java
index af2d85dd92..d2ce39c13f 100644
--- a/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java
@@ -89,12 +89,7 @@ public class GetPipelineStatusServlet extends
BaseHttpServlet implements IHopSer
String pipelineName = request.getParameter("name");
String id = request.getParameter("id");
- String root =
- request.getRequestURI() == null
- ? "/hop"
- : request.getRequestURI().substring(0,
request.getRequestURI().indexOf(CONTEXT_PATH));
- String prefix =
- isJettyMode() ? StatusServletUtils.STATIC_PATH : root +
StatusServletUtils.RESOURCES_PATH;
+ String prefix = getStaticPath(request, CONTEXT_PATH);
boolean useXml = "Y".equalsIgnoreCase(request.getParameter("xml"));
boolean useJson = "Y".equalsIgnoreCase(request.getParameter("json"));
int startLineNr = Const.toInt(request.getParameter("from"), 0);
@@ -225,12 +220,14 @@ public class GetPipelineStatusServlet extends
BaseHttpServlet implements IHopSer
}
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + prefix
+ + "/images/favicon.svg\">");
- if (isJettyMode()) {
- out.println(
- "<link rel=\"stylesheet\" type=\"text/css\"
href=\"/static/css/hop-server.css\" />");
- }
+ out.println(
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\""
+ + prefix
+ + "/css/hop-server.css\" />");
out.println("</HEAD>");
out.println("<BODY style=\"overflow: auto;\">");
diff --git a/engine/src/main/java/org/apache/hop/www/GetRootServlet.java
b/engine/src/main/java/org/apache/hop/www/GetRootServlet.java
index dfdc00eace..559f4e003c 100644
--- a/engine/src/main/java/org/apache/hop/www/GetRootServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/GetRootServlet.java
@@ -60,7 +60,10 @@ public class GetRootServlet extends BaseHttpServlet
implements IHopServerPlugin
+ BaseMessages.getString(PKG, "GetRootServlet.HopHopServer.Title")
+ "</TITLE>");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<H2>" + BaseMessages.getString(PKG,
"GetRootServlet.HopServerMenu") + "</H2>");
diff --git a/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java
b/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java
index c2bf0ff2e4..8f91b29576 100644
--- a/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/GetStatusServlet.java
@@ -96,12 +96,7 @@ public class GetStatusServlet extends BaseHttpServlet
implements IHopServerPlugi
logDebug(BaseMessages.getString(PKG,
"GetStatusServlet.StatusRequested"));
}
response.setStatus(HttpServletResponse.SC_OK);
- String root =
- request.getRequestURI() == null
- ? StatusServletUtils.HOP_ROOT
- : request.getRequestURI().substring(0,
request.getRequestURI().indexOf(CONTEXT_PATH));
- String prefix =
- isJettyMode() ? StatusServletUtils.STATIC_PATH : root +
StatusServletUtils.RESOURCES_PATH;
+ String prefix = getStaticPath(request, CONTEXT_PATH);
boolean useXml = "Y".equalsIgnoreCase(request.getParameter("xml"));
boolean useJson = "Y".equalsIgnoreCase(request.getParameter("json"));
boolean useLightTheme =
"Y".equalsIgnoreCase(request.getParameter("useLightTheme"));
@@ -172,27 +167,15 @@ public class GetStatusServlet extends BaseHttpServlet
implements IHopServerPlugi
+ BaseMessages.getString(PKG, "GetStatusServlet.HopServerStatus")
+ "</TITLE>");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\"" + prefix +
"/images/favicon.svg\">");
int tableBorder = 1;
if (!useLightTheme) {
- if (isJettyMode()) {
- out.println(
- "<link rel=\"stylesheet\" type=\"text/css\"
href=\"/static/css/hop-server.css\" />");
- } else {
- out.println("<style>");
- out.println(
- ".hop-table td, tr.cellTableRow, td.gwt-MenuItem,
.toolbar-button:not(.toolbar-button-disabled) {");
- out.println(" cursor: pointer;");
- out.println(CONST_CLOSE_BRACKET);
- out.println(".toolbar-button-disabled {");
- out.println(" opacity: 0.4;");
- out.println(CONST_CLOSE_BRACKET);
- out.println("div#messageDialogBody:first-letter {");
- out.println(" text-transform: capitalize;");
- out.println(CONST_CLOSE_BRACKET);
- out.println("</style>");
- }
+ out.println(
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\""
+ + prefix
+ + "/css/hop-server.css\" />");
tableBorder = 0;
}
diff --git
a/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java
b/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java
index 29c9dac86a..f293959768 100644
--- a/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java
@@ -80,12 +80,7 @@ public class GetWorkflowStatusServlet extends
BaseHttpServlet implements IHopSer
String workflowName = request.getParameter("name");
String id = request.getParameter("id");
- String root =
- request.getRequestURI() == null
- ? StatusServletUtils.HOP_ROOT
- : request.getRequestURI().substring(0,
request.getRequestURI().indexOf(CONTEXT_PATH));
- String prefix =
- isJettyMode() ? StatusServletUtils.STATIC_PATH : root +
StatusServletUtils.RESOURCES_PATH;
+ String prefix = getStaticPath(request, CONTEXT_PATH);
boolean useXml = "Y".equalsIgnoreCase(request.getParameter("xml"));
boolean useJson = "Y".equalsIgnoreCase(request.getParameter("json"));
int startLineNr = Const.toInt(request.getParameter("from"), 0);
@@ -230,12 +225,14 @@ public class GetWorkflowStatusServlet extends
BaseHttpServlet implements IHopSer
+ "\">");
}
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- if (isJettyMode()) {
- out.println(
- "<link rel=\"stylesheet\" type=\"text/css\"
href=\"/static/css/hop-server.css\" />");
- out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
- }
+ out.println(
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\""
+ + prefix
+ + "/css/hop-server.css\" />");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + prefix
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY style=\"overflow: auto;\">");
out.println("<div class=\"row\" id=\"pucHeader\">");
diff --git a/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java
index 422e3fd4dd..5057615d1b 100644
--- a/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/PausePipelineServlet.java
@@ -95,7 +95,9 @@ public class PausePipelineServlet extends BaseHttpServlet
implements IHopServerP
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git
a/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java
index 9f63fcbcd0..e4dd239cbc 100644
---
a/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java
+++
b/engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java
@@ -104,7 +104,10 @@ public class PrepareExecutionPipelineServlet extends
BaseHttpServlet implements
+ URLEncoder.encode(pipelineName, UTF_8)
+ CONST_CLOSE_TAG);
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git a/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java
index f8d14af15e..6275501d51 100644
--- a/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/RemovePipelineServlet.java
@@ -110,7 +110,9 @@ public class RemovePipelineServlet extends BaseHttpServlet
implements IHopServer
+ "</TITLE>");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
out.println(
diff --git a/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java
b/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java
index a70190fabd..3bae280b8b 100644
--- a/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/RemoveWorkflowServlet.java
@@ -110,7 +110,9 @@ public class RemoveWorkflowServlet extends BaseHttpServlet
implements IHopServer
+ "</TITLE>");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
out.println(
diff --git a/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java
b/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java
index 6acd04bcca..3ba2721df3 100644
--- a/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/SniffTransformServlet.java
@@ -267,7 +267,9 @@ public class SniffTransformServlet extends BaseHttpServlet
implements IHopServer
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
out.println(
diff --git
a/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java
index 96120bf68b..3c6611f96d 100644
--- a/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/StartExecutionPipelineServlet.java
@@ -94,7 +94,10 @@ public class StartExecutionPipelineServlet extends
BaseHttpServlet implements IH
+ URLEncoder.encode(pipelineName, UTF_8)
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git a/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java
index d308d67074..bf980f5e4f 100644
--- a/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/StartPipelineServlet.java
@@ -103,7 +103,10 @@ public class StartPipelineServlet extends BaseHttpServlet
implements IHopServerP
+ URLEncoder.encode(pipelineName, UTF_8)
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git a/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java
b/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java
index 814b8cfbb3..f2005b08b8 100644
--- a/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/StartWorkflowServlet.java
@@ -99,7 +99,10 @@ public class StartWorkflowServlet extends BaseHttpServlet
implements IHopServerP
+ URLEncoder.encode(workflowName, UTF_8)
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
- out.println("<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ out.println(
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git a/engine/src/main/java/org/apache/hop/www/StatusServletUtils.java
b/engine/src/main/java/org/apache/hop/www/StatusServletUtils.java
index e43c865ecb..17fba37597 100644
--- a/engine/src/main/java/org/apache/hop/www/StatusServletUtils.java
+++ b/engine/src/main/java/org/apache/hop/www/StatusServletUtils.java
@@ -19,7 +19,5 @@ package org.apache.hop.www;
public class StatusServletUtils {
- public static final String RESOURCES_PATH =
"/content/common-ui/resources/themes";
public static final String STATIC_PATH = "/static";
- public static final String HOP_ROOT = "/hop";
}
diff --git a/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java
b/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java
index 6f503f9800..dd1b5234e7 100644
--- a/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/StopPipelineServlet.java
@@ -92,7 +92,9 @@ public class StopPipelineServlet extends BaseHttpServlet
implements IHopServerPl
+ "\">");
out.println("<META http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">");
out.println(
- "<link rel=\"icon\" type=\"image/svg+xml\"
href=\"/static/images/favicon.svg\">");
+ "<link rel=\"icon\" type=\"image/svg+xml\" href=\""
+ + getStaticPath(request, CONTEXT_PATH)
+ + "/images/favicon.svg\">");
out.println("</HEAD>");
out.println("<BODY>");
}
diff --git a/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java
b/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java
index 375810b996..1b4cb152c0 100644
--- a/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java
+++ b/engine/src/test/java/org/apache/hop/www/GetStatusServletTest.java
@@ -18,6 +18,7 @@
package org.apache.hop.www;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
@@ -91,4 +92,30 @@ class GetStatusServletTest {
getStatusServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(out.toString().contains(ServletTestUtils.BAD_STRING_TO_TEST));
}
+
+ @Test
+ void testStatusServletServesStaticAssetsInWebMode() throws ServletException,
IOException {
+ HopLogStore.init();
+ // The default constructor leaves jettyMode = false, i.e. the Hop Web
(servlet container) mode.
+ GetStatusServlet servlet = new GetStatusServlet();
+ servlet.setPipelineMap(mockPipelineMap);
+ servlet.setWorkflowMap(mock(WorkflowMap.class));
+
+ HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
+ HttpServletResponse mockHttpServletResponse =
mock(HttpServletResponse.class);
+ StringWriter out = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(out);
+
+
when(mockHttpServletRequest.getRequestURI()).thenReturn(GetStatusServlet.CONTEXT_PATH);
+ when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
+
+ servlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
+
+ String html = out.toString();
+ // Regression for #7115: the legacy Pentaho asset path is not served by
Hop Web and must be
+ // gone; toolbar icons and the favicon must resolve under the served
"/static" location.
+ assertFalse(html.contains("/content/common-ui"));
+ assertTrue(html.contains("/static/images/run.svg"));
+ assertTrue(html.contains("/static/images/favicon.svg"));
+ }
}
diff --git
a/engine/src/test/java/org/apache/hop/www/StatusServletUtilsTest.java
b/engine/src/test/java/org/apache/hop/www/StatusServletUtilsTest.java
index 8b0ca7e36f..d77c599fa3 100644
--- a/engine/src/test/java/org/apache/hop/www/StatusServletUtilsTest.java
+++ b/engine/src/test/java/org/apache/hop/www/StatusServletUtilsTest.java
@@ -25,8 +25,6 @@ class StatusServletUtilsTest {
@Test
void constantsAreStable() {
- assertEquals("/content/common-ui/resources/themes",
StatusServletUtils.RESOURCES_PATH);
assertEquals("/static", StatusServletUtils.STATIC_PATH);
- assertEquals("/hop", StatusServletUtils.HOP_ROOT);
}
}