for (String path : webSocketHandlers.keySet()) { WebSocketCreator webSocketCreator = WebSocketCreatorFactory.create(webSocketHandlers.get(path)); webSocketConfiguration.addMapping(new ServletPathSpec(path), webSocketCreator);
p = ServletPathSpec.normalize(p); paths.add(p); context.getMetaData().setOrigin(filterName+".filter.mapping."+p, descriptor);
@Override public boolean matches(String path) { switch (group) { case EXACT: return pathSpec.equals(path); case PREFIX_GLOB: return isWildcardMatch(path); case SUFFIX_GLOB: return path.regionMatches((path.length() - specLength) + 1,pathSpec,1,specLength - 1); case ROOT: // Only "/" matches return ("/".equals(path)); case DEFAULT: // If we reached this point, then everything matches return true; default: return false; } } }
@Override public String getRelativePath(String base, String path) String info = getPathInfo(path); if (info == null)
public ServletPathSpec(String servletPathSpec) assertValidServletPathSpec(servletPathSpec);
@Override public boolean matches(String path) { switch (group) { case EXACT: return pathSpec.equals(path); case PREFIX_GLOB: return isWildcardMatch(path); case SUFFIX_GLOB: return path.regionMatches((path.length() - specLength) + 1,pathSpec,1,specLength - 1); case ROOT: // Only "/" matches return ("/".equals(path)); case DEFAULT: // If we reached this point, then everything matches return true; default: return false; } } }
@Override public String getRelativePath(String base, String path) String info = getPathInfo(path); if (info == null)
if (servletPathSpec.startsWith("servlet|")) servletPathSpec = servletPathSpec.substring("servlet|".length()); assertValidServletPathSpec(servletPathSpec);
public static PathSpec asPathSpec(String pathSpecString) { if ((pathSpecString == null) || (pathSpecString.length() < 1)) { throw new RuntimeException("Path Spec String must start with '^', '/', or '*.': got [" + pathSpecString + "]"); } return pathSpecString.charAt(0) == '^' ? new RegexPathSpec(pathSpecString):new ServletPathSpec(pathSpecString); }
@Override public boolean matches(String path) { switch (group) { case EXACT: return pathSpec.equals(path); case PREFIX_GLOB: return isWildcardMatch(path); case SUFFIX_GLOB: return path.regionMatches((path.length() - specLength) + 1,pathSpec,1,specLength - 1); case ROOT: // Only "/" matches return ("/".equals(path)); case DEFAULT: // If we reached this point, then everything matches return true; default: return false; } } }
p = ServletPathSpec.normalize(p);
@Override public String getRelativePath(String base, String path) String info = getPathInfo(path); if (info == null)
if (servletPathSpec.startsWith("servlet|")) servletPathSpec = servletPathSpec.substring("servlet|".length()); assertValidServletPathSpec(servletPathSpec);
public static PathSpec asPathSpec(String pathSpecString) { if ((pathSpecString == null) || (pathSpecString.length() < 1)) { throw new RuntimeException("Path Spec String must start with '^', '/', or '*.': got [" + pathSpecString + "]"); } return pathSpecString.charAt(0) == '^' ? new RegexPathSpec(pathSpecString):new ServletPathSpec(pathSpecString); }
@Override public boolean matches(String path) { switch (group) { case EXACT: return pathSpec.equals(path); case PREFIX_GLOB: return isWildcardMatch(path); case SUFFIX_GLOB: return path.regionMatches((path.length() - specLength) + 1,pathSpec,1,specLength - 1); case ROOT: // Only "/" matches return ("/".equals(path)); case DEFAULT: // If we reached this point, then everything matches return true; default: return false; } } }
url = ServletPathSpec.normalize(url);
@Override public String getRelativePath(String base, String path) String info = getPathInfo(path); if (info == null)
if (servletPathSpec.startsWith("servlet|")) servletPathSpec = servletPathSpec.substring("servlet|".length()); assertValidServletPathSpec(servletPathSpec);
private PathSpec toPathSpec(String rawSpec) { if ((rawSpec == null) || (rawSpec.length() < 1)) { throw new RuntimeException("Path Spec String must start with '^', '/', or '*.': got [" + rawSpec + "]"); } if (rawSpec.charAt(0) == '^') { return new RegexPathSpec(rawSpec); } else { return new ServletPathSpec(rawSpec); } }