From cf6775dc87dc49c744041784e339ed1729439344 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Wed, 7 May 2014 14:38:34 -0400 Subject: [PATCH] Add whitelist-prefix init-parameter to PageFlowPageFilter, since /portlets/*.jsp is invalid syntax and is not allowed by tomcat --- .../beehive/netui/pageflow/PageFlowPageFilter.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java b/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java index 5515d99..41358f7 100644 --- a/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java +++ b/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java @@ -67,6 +67,7 @@ public abstract class PageFlowPageFilter private ServletContainerAdapter _servletContainerAdapter; private FlowControllerFactory _flowControllerFactory; private Map _knownModulePaths = new InternalConcurrentHashMap(); + private String whitelistPrefix = null; protected PageFlowPageFilter() { @@ -92,6 +93,8 @@ public abstract class PageFlowPageFilter _servletContainerAdapter = AdapterManager.getServletContainerAdapter( _servletContext ); _flowControllerFactory = FlowControllerFactory.get( _servletContext ); + + whitelistPrefix = filterConfig.getInitParameter("whitelist-prefix"); } public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain ) @@ -116,6 +119,16 @@ public abstract class PageFlowPageFilter } String servletPath = InternalUtils.getDecodedServletPath( httpRequest ); + + if (whitelistPrefix != null && !servletPath.startsWith(whitelistPrefix)) { + if (LOG.isDebugEnabled()) + LOG.debug("Path " + servletPath + + " does not start with specified whitelist-prefix " + whitelistPrefix + ". Skipping filter."); + + continueChainNoWrapper(request, response, chain); + return; + } + String extension = FileUtils.getFileExtension( servletPath ); Set validFileExtensions = getValidFileExtensions();