Author: mgrigorov Date: Sat Nov 6 09:37:08 2010 New Revision: 1031986 URL: http://svn.apache.org/viewvc?rev=1031986&view=rev Log: WICKET-3147 Servlet 3 Annotation @WebFilter is not supported
Allow 'filterPath' to be "". Both org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromConfig(FilterConfig) and org.apache.wicket.protocol.http.WicketFilter.getFilterPathFromWebXml(boolean, FilterConfig) could return "". Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?rev=1031986&r1=1031985&r2=1031986&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Sat Nov 6 09:37:08 2010 @@ -117,7 +117,7 @@ public class WicketFilter implements Fil // Make sure getFilterPath() gets called before checkIfRedirectRequired() String filterPath = getFilterPath(httpServletRequest); - if (Strings.isEmpty(filterPath)) + if (filterPath == null) { throw new IllegalStateException("filter path was not configured"); } @@ -407,19 +407,22 @@ public class WicketFilter implements Fil protected String getFilterPathFromConfig(FilterConfig filterConfig) { String result = filterConfig.getInitParameter(FILTER_MAPPING_PARAM); - if (result == null || result.equals("/*")) + if (result != null) { - filterPath = ""; - } - else if (!result.startsWith("/") || !result.endsWith("/*")) - { - throw new WicketRuntimeException("Your " + FILTER_MAPPING_PARAM + - " must start with \"/\" and end with \"/*\". It is: " + result); - } - else - { - // remove leading "/" and trailing "*" - filterPath = result.substring(1, result.length() - 1); + if (result.equals("/*")) + { + filterPath = ""; + } + else if (!result.startsWith("/") || !result.endsWith("/*")) + { + throw new WicketRuntimeException("Your " + FILTER_MAPPING_PARAM + + " must start with \"/\" and end with \"/*\". It is: " + result); + } + else + { + // remove leading "/" and trailing "*" + filterPath = result.substring(1, result.length() - 1); + } } return filterPath; }