You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2012/07/19 14:55:14 UTC
svn commit: r1363319 - in /activemq/trunk:
activemq-core/src/main/java/org/apache/activemq/broker/
activemq-web-console/src/main/java/org/apache/activemq/web/filter/
activemq-web-console/src/main/webapp/
activemq-web-console/src/main/webapp/WEB-INF/ ac...
Author: dejanb
Date: Thu Jul 19 12:55:14 2012
New Revision: 1363319
URL: http://svn.apache.org/viewvc?rev=1363319&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3696 - fix web console to show special page for slave brokers
Added:
activemq/trunk/activemq-web-console/src/main/webapp/slave.jsp
- copied, changed from r1363003, activemq/trunk/activemq-web-console/src/main/webapp/404.html
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/filter/ApplicationContextFilter.java
activemq/trunk/activemq-web-console/src/main/webapp/404.html
activemq/trunk/activemq-web-console/src/main/webapp/500.html
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/decorators.xml
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java Thu Jul 19 12:55:14 2012
@@ -520,7 +520,7 @@ public class BrokerService implements Se
if (isUseJmx()) {
startManagementContext();
}
-
+ BrokerRegistry.getInstance().bind(getBrokerName(), BrokerService.this);
startPersistenceAdapter(startAsync);
startBroker(startAsync);
} catch (Exception e) {
@@ -608,7 +608,6 @@ public class BrokerService implements Se
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) {
Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/filter/ApplicationContextFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/filter/ApplicationContextFilter.java?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/filter/ApplicationContextFilter.java (original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/filter/ApplicationContextFilter.java Thu Jul 19 12:55:14 2012
@@ -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 im
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 im
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);
Modified: activemq/trunk/activemq-web-console/src/main/webapp/404.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/404.html?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/404.html (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/404.html Thu Jul 19 12:55:14 2012
@@ -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>
Modified: activemq/trunk/activemq-web-console/src/main/webapp/500.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/500.html?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/500.html (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/500.html Thu Jul 19 12:55:14 2012
@@ -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>
Modified: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/decorators.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/decorators.xml?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/decorators.xml (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/decorators.xml Thu Jul 19 12:55:14 2012
@@ -19,6 +19,7 @@
<decorators defaultdir="/decorators">
<excludes>
<pattern>/xml/*</pattern>
+ <pattern>/slave.jsp</pattern>
</excludes>
<decorator name="main" page="main.jsp">
Copied: activemq/trunk/activemq-web-console/src/main/webapp/slave.jsp (from r1363003, activemq/trunk/activemq-web-console/src/main/webapp/404.html)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/slave.jsp?p2=activemq/trunk/activemq-web-console/src/main/webapp/slave.jsp&p1=activemq/trunk/activemq-web-console/src/main/webapp/404.html&r1=1363003&r2=1363319&rev=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/404.html (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/slave.jsp Thu Jul 19 12:55:14 2012
@@ -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>
@@ -77,13 +77,7 @@
<tr>
<td valign="top" width="100%" style="overflow:hidden;">
<div class="body-content">
- <p class="error">Page Not Found!</p>
-
- <p>What do you want to do next?</p>
- <ul class="alternate" type="square">
- <li><a title="Manage ActiveMQ broker" href="/admin/">Manage ActiveMQ broker</a></li>
- <li><a title="See some Web demos" href="/demo/">See some Web demos</a></li>
- </ul>
+ <p align="center">Broker is currently in <b>slave</b> mode!</p>
</div>
</td>
<td valign="top">
@@ -133,4 +127,4 @@
<div class="design_attribution"><a href="http://hiramchirino.com/">Graphic Design By Hiram</a></div>
</body>
-</html>
+</html>
\ No newline at end of file
Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java (original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java Thu Jul 19 12:55:14 2012
@@ -209,4 +209,6 @@ public interface BrokerFacade {
boolean isJobSchedulerStarted();
+ boolean isSlave() throws Exception;
+
}
\ No newline at end of file
Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java?rev=1363319&r1=1363318&r2=1363319&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java (original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java Thu Jul 19 12:55:14 2012
@@ -226,4 +226,8 @@ public abstract class BrokerFacadeSuppor
return false;
}
}
+
+ public boolean isSlave() throws Exception {
+ return getBrokerAdmin().isSlave();
+ }
}