mirror of https://github.com/apache/activemq.git
ensure connection/authentication errors with broker facade end up in the log as referenced by our 500 page
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1412899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
51785b1472
commit
02538ed906
|
@ -33,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.activemq.web.BrokerFacade;
|
import org.apache.activemq.web.BrokerFacade;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.ServletRequestDataBinder;
|
import org.springframework.web.bind.ServletRequestDataBinder;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
|
@ -58,6 +60,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ApplicationContextFilter implements Filter {
|
public class ApplicationContextFilter implements Filter {
|
||||||
|
private static final transient Logger LOG = LoggerFactory.getLogger(ApplicationContextFilter.class);
|
||||||
|
|
||||||
private ServletContext servletContext;
|
private ServletContext servletContext;
|
||||||
private String applicationContextName = "applicationContext";
|
private String applicationContextName = "applicationContext";
|
||||||
|
@ -83,12 +86,16 @@ public class ApplicationContextFilter implements Filter {
|
||||||
String path = ((HttpServletRequest)request).getRequestURI();
|
String path = ((HttpServletRequest)request).getRequestURI();
|
||||||
// handle slave brokers
|
// handle slave brokers
|
||||||
try {
|
try {
|
||||||
if (((BrokerFacade)requestContextWrapper.get("brokerQuery")).isSlave()
|
if ( !(path.endsWith("css") || path.endsWith("png") || path.endsWith("ico") || path.endsWith(slavePage))
|
||||||
&& (!(path.endsWith("css") || path.endsWith("png")) && !path.endsWith(slavePage))) {
|
&& ((BrokerFacade)requestContextWrapper.get("brokerQuery")).isSlave()) {
|
||||||
((HttpServletResponse)response).sendRedirect(slavePage);
|
((HttpServletResponse)response).sendRedirect(slavePage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} 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);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
request.setAttribute(requestContextName, requestContextWrapper);
|
request.setAttribute(requestContextName, requestContextWrapper);
|
||||||
|
|
|
@ -51,6 +51,11 @@ public final class Main {
|
||||||
SelectChannelConnector connector = new SelectChannelConnector();
|
SelectChannelConnector connector = new SelectChannelConnector();
|
||||||
connector.setPort(port);
|
connector.setPort(port);
|
||||||
connector.setServer(server);
|
connector.setServer(server);
|
||||||
|
|
||||||
|
//System.setProperty("webconsole.type","properties");
|
||||||
|
//System.setProperty("webconsole.jms.url","tcp://localhost:61616");
|
||||||
|
//System.setProperty("webconsole.jmx.url","service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root");
|
||||||
|
|
||||||
WebAppContext context = new WebAppContext();
|
WebAppContext context = new WebAppContext();
|
||||||
|
|
||||||
context.setResourceBase(WEBAPP_DIR);
|
context.setResourceBase(WEBAPP_DIR);
|
||||||
|
|
Loading…
Reference in New Issue