ARTEMIS-3980 Remove web content from distribution
This commit is contained in:
parent
8d1865fdcb
commit
e7ff8fd427
|
@ -1,5 +1,5 @@
|
|||
<!-- The web server is only bound to localhost by default -->
|
||||
<web path="web">
|
||||
<web path="web" rootRedirectLocation="console">
|
||||
<binding uri="${web.protocol}://${http.host}:${http.port}"${extra.web.attributes}>
|
||||
<app url="activemq-branding" war="activemq-branding.war"/>
|
||||
<app url="artemis-plugin" war="artemis-plugin.war"/>
|
||||
|
|
|
@ -82,29 +82,6 @@
|
|||
<directoryMode>0755</directoryMode>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>org.apache.activemq:artemis-website</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>org.apache.activemq:artemis-website:jar:javadoc</exclude>
|
||||
</excludes>
|
||||
<outputDirectory>web</outputDirectory>
|
||||
<unpack>true</unpack>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<directoryMode>0755</directoryMode>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>org.apache.activemq:artemis-website:jar:javadoc</include>
|
||||
</includes>
|
||||
<outputDirectory>web/api</outputDirectory>
|
||||
<unpack>true</unpack>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<directoryMode>0755</directoryMode>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
|
||||
<!-- Management Console Dependencies -->
|
||||
<dependencySet>
|
||||
|
|
|
@ -88,6 +88,12 @@ public class WebServerDTO extends ComponentDTO {
|
|||
@XmlAttribute
|
||||
private String excludedCipherSuites;
|
||||
|
||||
@XmlAttribute
|
||||
public String rootRedirectLocation;
|
||||
|
||||
@XmlAttribute
|
||||
public Boolean webContentEnabled;
|
||||
|
||||
public WebServerDTO() {
|
||||
componentClassName = "org.apache.activemq.artemis.component.WebServerComponent";
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ var Branding = (function (Branding) {
|
|||
"description": "ActiveMQ Artemis Management Console",
|
||||
"links": [
|
||||
{
|
||||
"url": "/user-manual/index.html",
|
||||
"text": "User Manual"
|
||||
"text": "Documentation",
|
||||
"url": "https://activemq.apache.org/components/artemis/documentation/",
|
||||
},
|
||||
{
|
||||
"url": "https://activemq.apache.org/",
|
||||
"text": "Website"
|
||||
"text": "Website",
|
||||
"url": "https://activemq.apache.org/"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.activemq.artemis.component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
||||
public class DefaultHandler extends org.eclipse.jetty.server.handler.DefaultHandler {
|
||||
private String rootRedirectLocation;
|
||||
|
||||
public String getRootRedirectLocation() {
|
||||
return rootRedirectLocation;
|
||||
}
|
||||
|
||||
public void setRootRedirectLocation(String rootRedirectLocation) {
|
||||
this.rootRedirectLocation = rootRedirectLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(String target,
|
||||
Request baseRequest,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) throws IOException, ServletException {
|
||||
if (rootRedirectLocation != null && target.matches("^$|/")) {
|
||||
response.sendRedirect("/console");
|
||||
} else {
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,6 @@ import org.eclipse.jetty.server.Server;
|
|||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.SslConnectionFactory;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerList;
|
||||
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
|
@ -166,12 +165,18 @@ public class WebServerComponent implements ExternalComponent, WebServerComponent
|
|||
|
||||
DefaultHandler defaultHandler = new DefaultHandler();
|
||||
defaultHandler.setServeIcon(false);
|
||||
defaultHandler.setRootRedirectLocation(this.webServerConfig.rootRedirectLocation);
|
||||
|
||||
if (this.webServerConfig.requestLog != null) {
|
||||
handlers.addHandler(getLogHandler());
|
||||
}
|
||||
handlers.addHandler(homeContext);
|
||||
handlers.addHandler(instanceContext);
|
||||
|
||||
if (this.webServerConfig.webContentEnabled != null &&
|
||||
this.webServerConfig.webContentEnabled) {
|
||||
handlers.addHandler(homeContext);
|
||||
handlers.addHandler(instanceContext);
|
||||
}
|
||||
|
||||
handlers.addHandler(defaultHandler); // this should be last
|
||||
|
||||
server.setHandler(handlers);
|
||||
|
|
|
@ -120,6 +120,7 @@ public class WebServerComponentTest extends Assert {
|
|||
WebServerDTO webServerDTO = new WebServerDTO();
|
||||
webServerDTO.setBindings(Collections.singletonList(bindingDTO));
|
||||
webServerDTO.path = "webapps";
|
||||
webServerDTO.webContentEnabled = true;
|
||||
if (useCustomizer) {
|
||||
webServerDTO.customizer = TestCustomizer.class.getName();
|
||||
}
|
||||
|
@ -163,6 +164,7 @@ public class WebServerComponentTest extends Assert {
|
|||
WebServerDTO webServerDTO = new WebServerDTO();
|
||||
webServerDTO.setBindings(Collections.singletonList(bindingDTO));
|
||||
webServerDTO.path = "webapps";
|
||||
webServerDTO.webContentEnabled = true;
|
||||
WebServerComponent webServerComponent = new WebServerComponent();
|
||||
Assert.assertFalse(webServerComponent.isStarted());
|
||||
webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/");
|
||||
|
@ -186,6 +188,7 @@ public class WebServerComponentTest extends Assert {
|
|||
WebServerDTO webServerDTO = new WebServerDTO();
|
||||
webServerDTO.setBindings(Collections.singletonList(bindingDTO));
|
||||
webServerDTO.path = "webapps";
|
||||
webServerDTO.webContentEnabled = true;
|
||||
WebServerComponent webServerComponent = new WebServerComponent();
|
||||
Assert.assertFalse(webServerComponent.isStarted());
|
||||
webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/");
|
||||
|
@ -228,6 +231,7 @@ public class WebServerComponentTest extends Assert {
|
|||
WebServerDTO webServerDTO = new WebServerDTO();
|
||||
webServerDTO.setBindings(Collections.singletonList(bindingDTO));
|
||||
webServerDTO.path = "webapps";
|
||||
webServerDTO.webContentEnabled = true;
|
||||
|
||||
WebServerComponent webServerComponent = new WebServerComponent();
|
||||
Assert.assertFalse(webServerComponent.isStarted());
|
||||
|
@ -298,6 +302,7 @@ public class WebServerComponentTest extends Assert {
|
|||
WebServerDTO webServerDTO = new WebServerDTO();
|
||||
webServerDTO.setBindings(Collections.singletonList(bindingDTO));
|
||||
webServerDTO.path = "webapps";
|
||||
webServerDTO.webContentEnabled = true;
|
||||
|
||||
WebServerComponent webServerComponent = new WebServerComponent();
|
||||
Assert.assertFalse(webServerComponent.isStarted());
|
||||
|
|
|
@ -27,6 +27,10 @@ The `web` element has the following attributes:
|
|||
archives (i.e. WAR files). This is a subdirectory of the broker's home or
|
||||
instance directory.
|
||||
- `customizer` The name of customizer class to load.
|
||||
- `rootRedirectLocation` The location to redirect the requests with the root
|
||||
target.
|
||||
- `webContentEnabled` Whether or not the content included in the web folder of
|
||||
the home and the instance directories is accessible. Default is false.
|
||||
|
||||
The `web` element should contain at least one `binding` element to configure how
|
||||
clients can connect to the web-server. A `binding` element has the following
|
||||
|
|
|
@ -17,25 +17,19 @@
|
|||
|
||||
package org.apache.activemq.artemis.tests.smoke.console;
|
||||
|
||||
import org.apache.activemq.artemis.tests.smoke.console.pages.IndexPage;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.MutableCapabilities;
|
||||
|
||||
public class IndexTest extends ConsoleTest {
|
||||
public class RootTest extends ConsoleTest {
|
||||
|
||||
protected static final String DEFAULT_CONSOLE_INDEX_LOGO_IMAGE = "/images/activemq-logo.png";
|
||||
|
||||
public IndexTest(MutableCapabilities browserOptions) {
|
||||
public RootTest(MutableCapabilities browserOptions) {
|
||||
super(browserOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndexLogo() {
|
||||
String expectedLogoImage = serverUrl + System.getProperty(
|
||||
"artemis.console.index.logo.image", DEFAULT_CONSOLE_INDEX_LOGO_IMAGE);
|
||||
|
||||
public void testRedirect() {
|
||||
driver.get(serverUrl);
|
||||
IndexPage indexPage = new IndexPage(driver);
|
||||
assertEquals(expectedLogoImage, indexPage.getLogoImage(DEFAULT_TIMEOUT));
|
||||
Assert.assertTrue(driver.getCurrentUrl().startsWith(serverUrl + "/console"));
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.tests.smoke.console.pages;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class IndexPage extends ConsolePage {
|
||||
private By logoImageLocator = By.xpath("//div[@class='logo']/img");
|
||||
|
||||
public IndexPage(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public String getLogoImage(int timeout) {
|
||||
waitForElementToBeVisible(logoImageLocator, timeout);
|
||||
|
||||
return driver.findElement(logoImageLocator).getAttribute("src");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue