diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/server/ClientConfigurationServlet.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/server/ClientConfigurationServlet.java index b21fc0641f6..e6984ee1cd6 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/server/ClientConfigurationServlet.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/server/ClientConfigurationServlet.java @@ -15,25 +15,21 @@ public class ClientConfigurationServlet extends HttpServlet { /** serial version uid */ private static final long serialVersionUID = -2228462977010198686L; + + public static final String DEBRANDING_PROPERTY_NAME = "com.sap.sailing.debranding"; private final ConcurrentHashMap cache = new ConcurrentHashMap<>(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - - boolean debugDebranding = false; - if (req.getParameterMap().containsKey("whitelabel")) { // override with url parameter for testing usage only - debugDebranding = true; - } - + + final boolean deBrandingActive = Boolean.valueOf(System.getProperty(DEBRANDING_PROPERTY_NAME, "false")); final String servletPath = req.getServletPath(); byte[] value = null; - if (!debugDebranding && (value = cache.get(servletPath)) != null) { + if ((value = cache.get(generateKey(servletPath, deBrandingActive))) != null) { IOUtils.write(value, resp.getOutputStream()); return; } - - boolean deBrandingActive = Boolean.valueOf(System.getProperty("com.sap.sailing.debranding", "false")) || debugDebranding; String title = ""; String faviconPath = "images/whitelabel.ico"; @@ -54,10 +50,12 @@ public class ClientConfigurationServlet extends HttpServlet { byte[] bytes = replaced.getBytes(); IOUtils.write(bytes, resp.getOutputStream()); - if (!debugDebranding) { - cache.computeIfAbsent(servletPath, key -> bytes); - } + cache.computeIfAbsent(generateKey(servletPath, deBrandingActive), key -> bytes); } } + private String generateKey(String servletPath, boolean active) { + return servletPath + "_" + active; + } + } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/HostPage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/HostPage.java index 2ddd8e7ac52..15adf9e5fae 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/HostPage.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/HostPage.java @@ -40,19 +40,23 @@ public abstract class HostPage extends PageObject { throw new IllegalArgumentException(exc); } } - + private static final void goToPage(WebDriver driver, URI uri) throws URISyntaxException { - String scheme = uri.getScheme(), userInfo = uri.getUserInfo(), host = uri.getHost(); - String path = uri.getPath(), query = getGWTCodeServerAndLocale() + "&" + uri.getQuery(), fragment = uri.getFragment(); + String scheme = uri.getScheme(), userInfo = uri.getUserInfo(), host = uri.getHost(); + String path = uri.getPath(), + query = getGWTCodeServerAndLocale() + (uri.getQuery() != null ? "&" + uri.getQuery() : ""), + fragment = uri.getFragment(); driver.get(new URI(scheme, userInfo, host, uri.getPort(), path, query, fragment).toString()); } - + /** - *

Creates a new page object with the given web driver. In GWT an entry point is connected to a HTML page in - * which the code for the application is executed, whereby the page is represented by the web driver.

+ *

+ * Creates a new page object with the given web driver. In GWT an entry point is connected to a HTML page in which + * the code for the application is executed, whereby the page is represented by the web driver. + *

* * @param driver - * The web driver to use. + * The web driver to use. */ public HostPage(WebDriver driver) { super(driver); diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java index d76fd95ab62..342f7e8aeda 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/home/HomePage.java @@ -58,11 +58,7 @@ public class HomePage extends HostPageWithAuthentication { * @return the {@link PageObject} for the home page */ public static HomePage goToPage(WebDriver driver, String root) { - return goToPage(driver, root, false); - } - - public static HomePage goToPage(WebDriver driver, String root, boolean debranded) { - return goToHomeUrl(driver, root + "gwt/Home.html" + (debranded ? "?whitelabel" : "")); + return goToHomeUrl(driver, root + "gwt/Home.html"); } /**