mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3696 - fix web console to show special page for slave brokers
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1363319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f135b7ab76
commit
3c4848b8a5
|
@ -520,7 +520,7 @@ public class BrokerService implements Service {
|
|||
if (isUseJmx()) {
|
||||
startManagementContext();
|
||||
}
|
||||
|
||||
BrokerRegistry.getInstance().bind(getBrokerName(), BrokerService.this);
|
||||
startPersistenceAdapter(startAsync);
|
||||
startBroker(startAsync);
|
||||
} catch (Exception e) {
|
||||
|
@ -608,7 +608,6 @@ public class BrokerService implements Service {
|
|||
managedBroker.setContextBroker(broker);
|
||||
adminView.setBroker(managedBroker);
|
||||
}
|
||||
BrokerRegistry.getInstance().bind(getBrokerName(), BrokerService.this);
|
||||
// see if there is a MasterBroker service and if so, configure
|
||||
// it and start it.
|
||||
for (Service service : services) {
|
||||
|
|
|
@ -29,7 +29,10 @@ import javax.servlet.ServletContext;
|
|||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.activemq.web.BrokerFacade;
|
||||
import org.springframework.web.bind.ServletRequestDataBinder;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
@ -60,6 +63,7 @@ public class ApplicationContextFilter implements Filter {
|
|||
private String applicationContextName = "applicationContext";
|
||||
private String requestContextName = "requestContext";
|
||||
private String requestName = "request";
|
||||
private final String slavePage = "slave.jsp";
|
||||
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
this.servletContext = config.getServletContext();
|
||||
|
@ -76,6 +80,17 @@ public class ApplicationContextFilter implements Filter {
|
|||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
// lets register a requestContext in the requestScope
|
||||
Map requestContextWrapper = createRequestContextWrapper(request);
|
||||
String path = ((HttpServletRequest)request).getRequestURI();
|
||||
// handle slave brokers
|
||||
try {
|
||||
if (((BrokerFacade)requestContextWrapper.get("brokerQuery")).isSlave()
|
||||
&& (!(path.endsWith("css") || path.endsWith("png")) && !path.endsWith(slavePage))) {
|
||||
((HttpServletResponse)response).sendRedirect(slavePage);
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
request.setAttribute(requestContextName, requestContextWrapper);
|
||||
request.setAttribute(requestName, request);
|
||||
chain.doFilter(request, response);
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Apache ActiveMQ</title>
|
||||
<style type="text/css" media="screen">
|
||||
@import url(styles/type-settings.css);
|
||||
@import url(styles/site.css);
|
||||
@import url('${pageContext.request.contextPath}/styles/type-settings.css');
|
||||
@import url('${pageContext.request.contextPath}/styles/site.css');
|
||||
</style>
|
||||
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Apache ActiveMQ</title>
|
||||
<style type="text/css" media="screen">
|
||||
@import url(styles/type-settings.css);
|
||||
@import url(styles/site.css);
|
||||
@import url('${pageContext.request.contextPath}/styles/type-settings.css');
|
||||
@import url('${pageContext.request.contextPath}/styles/site.css');
|
||||
</style>
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<decorators defaultdir="/decorators">
|
||||
<excludes>
|
||||
<pattern>/xml/*</pattern>
|
||||
<pattern>/slave.jsp</pattern>
|
||||
</excludes>
|
||||
|
||||
<decorator name="main" page="main.jsp">
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Apache ActiveMQ</title>
|
||||
<style type="text/css" media="screen">
|
||||
@import url('${pageContext.request.contextPath}/styles/type-settings.css');
|
||||
@import url('${pageContext.request.contextPath}/styles/site.css');
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<div class="white_box">
|
||||
<div class="header">
|
||||
<div class="header_l">
|
||||
<div class="header_r">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content_l">
|
||||
<div class="content_r">
|
||||
|
||||
<div>
|
||||
|
||||
<!-- Banner -->
|
||||
<div id="asf_logo">
|
||||
<div id="activemq_logo">
|
||||
<a style="float:left; width:280px;display:block;text-indent:-5000px;text-decoration:none;line-height:60px; margin-top:10px; margin-left:100px;"
|
||||
href="http://activemq.apache.org/"
|
||||
title="The most popular and powerful open source Message Broker">ActiveMQ</a>
|
||||
<a style="float:right; width:210px;display:block;text-indent:-5000px;text-decoration:none;line-height:60px; margin-top:15px; margin-right:10px;"
|
||||
href="http://www.apache.org/" title="The Apache Software Foundation">ASF</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="top_red_bar">
|
||||
<div id="site-breadcrumbs">
|
||||
</div>
|
||||
<div id="site-quicklinks"><p>
|
||||
<a href="http://activemq.apache.org/support.html"
|
||||
title="Get help and support using Apache ActiveMQ">Support</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table border="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="100%" style="overflow:hidden;">
|
||||
<div class="body-content">
|
||||
<p align="center">Broker is currently in <b>slave</b> mode!</p>
|
||||
</div>
|
||||
</td>
|
||||
<td valign="top">
|
||||
|
||||
<div class="navigation">
|
||||
<div class="navigation_top">
|
||||
<div class="navigation_bottom">
|
||||
<h3>Useful Links</h3>
|
||||
|
||||
<ul class="alternate" type="square">
|
||||
<li><a href="http://activemq.apache.org/"
|
||||
title="The most popular and powerful open source Message Broker">Documentation</a></li>
|
||||
<li><a href="http://activemq.apache.org/faq.html">FAQ</a></li>
|
||||
<li><a href="http://activemq.apache.org/download.html">Downloads</a>
|
||||
</li>
|
||||
<li><a href="http://activemq.apache.org/discussion-forums.html">Forums</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="bottom_red_bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="black_box">
|
||||
<div class="footer">
|
||||
<div class="footer_l">
|
||||
<div class="footer_r">
|
||||
<div>
|
||||
Copyright 2005-2012 The Apache Software Foundation.
|
||||
|
||||
(<a href="?printable=true">printable version</a>)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="design_attribution"><a href="http://hiramchirino.com/">Graphic Design By Hiram</a></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -209,4 +209,6 @@ public interface BrokerFacade {
|
|||
|
||||
boolean isJobSchedulerStarted();
|
||||
|
||||
boolean isSlave() throws Exception;
|
||||
|
||||
}
|
|
@ -226,4 +226,8 @@ public abstract class BrokerFacadeSupport implements BrokerFacade {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSlave() throws Exception {
|
||||
return getBrokerAdmin().isSlave();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue