Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class ApplicationContextFilter implements Filter {
private String applicationContextName = "applicationContext";
private String requestContextName = "requestContext";
private String requestName = "request";
private String slavePage = "slave.jsp";

public void init(FilterConfig config) throws ServletException {
this.servletContext = config.getServletContext();
Expand All @@ -84,19 +85,22 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
Map requestContextWrapper = createRequestContextWrapper(request);
String path = ((HttpServletRequest)request).getRequestURI();
// handle slave brokers
// try {
// if ( !(path.endsWith("css") || path.endsWith("png") || path.endsWith("ico") || path.endsWith(slavePage))
// && ((BrokerFacade)requestContextWrapper.get("brokerQuery")).isSlave()) {
// ((HttpServletResponse)response).sendRedirect(slavePage);
// return;
// }
// } catch (Exception e) {
// LOG.warn(path + ", failed to access BrokerFacade: reason: " + e.getLocalizedMessage());
// if (LOG.isDebugEnabled()) {
// LOG.debug(request.toString(), e);
// }
// throw new IOException(e);
// }
try {
boolean isSlave = ((BrokerFacade) requestContextWrapper.get("brokerQuery")).getBrokerAdmin().isSlave();
if (isSlave && !(path.endsWith("css") || path.endsWith("png") || path.endsWith("ico") || path.endsWith(slavePage))) {
((HttpServletResponse) response).sendRedirect(slavePage);
return;
} else if (!isSlave && path.endsWith(slavePage)) {
((HttpServletResponse) response).sendRedirect(((HttpServletRequest) request).getContextPath() + "/index.jsp");
return;
}
} catch (Exception e) {
LOG.warn(path + ", failed to access BrokerFacade: reason: " + e.getLocalizedMessage());
if (LOG.isDebugEnabled()) {
LOG.debug(request.toString(), e);
}
throw new IOException(e);
}
request.setAttribute(requestContextName, requestContextWrapper);
request.setAttribute(requestName, request);
chain.doFilter(request, response);
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/release/conf/activemq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" id="broker">

<destinationPolicy>
<policyMap>
Expand Down
6 changes: 3 additions & 3 deletions assembly/src/release/conf/jetty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@
</property>
</bean>

<bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
depends-on="configureJetty, invokeConnectors">
<bean id="invokeStart" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
depends-on="broker, configureJetty, invokeConnectors">
<property name="targetObject" ref="Server" />
<property name="targetMethod" value="start" />
<property name="targetMethod" value="start" />
</bean>


Expand Down
2 changes: 1 addition & 1 deletion assembly/src/release/examples/conf/activemq-demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- Change the brokerName attribute to something unique
-->

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="amq-broker" useJmx="true">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="amq-broker" useJmx="true" id="broker">

<!--
Examples of destination-specific policies using destination
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/release/examples/conf/activemq-security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</bean>
-->

<broker useJmx="true" persistent="false" xmlns="http://activemq.apache.org/schema/core" >
<broker useJmx="true" persistent="false" xmlns="http://activemq.apache.org/schema/core" id="broker">

<managementContext>
<managementContext createConnector="true">
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/release/examples/conf/activemq-stomp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" id="broker">

<!--
For better performances use VM cursor and small memory limit.
Expand Down