@Test public void testGetResourcePathParts() { assertNull(ProbeFilter.getResourcePathParts("/foo/bar", "/foo")); assertArrayEquals(new String[] { "deployment" }, ProbeFilter.getResourcePathParts("/foo/weld-probe/deployment", "/foo")); assertArrayEquals(new String[] { "beans", "1", "instance" }, ProbeFilter.getResourcePathParts("/foo/weld-probe/beans/1/instance", "/foo")); assertArrayEquals(new String[] {}, ProbeFilter.getResourcePathParts("/foo/weld-probe", "/foo")); }
static String[] getResourcePathParts(String requestUri, String contextPath) { final String path = requestUri.substring(contextPath.length(), requestUri.length()); if (path.startsWith(REST_URL_PATTERN_BASE)) { return Resource.splitPath(path.substring(REST_URL_PATTERN_BASE.length(), path.length())); } return null; }
ProbeFilter implements Filter { static String[] getResourcePathParts(String requestUri, String contextPath) { final String path = requestUri.substring(contextPath.length(), requestUri.length()); if (path.startsWith(REST_URL_PATTERN_BASE)) { return Resource.splitPath(path.substring(REST_URL_PATTERN_BASE.length(), path.length())); } return null; } }
ProbeFilter implements Filter { static String[] getResourcePathParts(String requestUri, String contextPath) { final String path = requestUri.substring(contextPath.length(), requestUri.length()); if (path.startsWith(REST_URL_PATTERN_BASE)) { return Resource.splitPath(path.substring(REST_URL_PATTERN_BASE.length(), path.length())); } return null; }  }
ProbeFilter implements Filter { static String[] getResourcePathParts(String requestUri, String contextPath) { final String path = requestUri.substring(contextPath.length(), requestUri.length()); if (path.startsWith(REST_URL_PATTERN_BASE)) { return Resource.splitPath(path.substring(REST_URL_PATTERN_BASE.length(), path.length())); } return null; }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void destroy(); }
ProbeFilter implements Filter { static String[] getResourcePathParts(String requestUri, String contextPath) { final String path = requestUri.substring(contextPath.length(), requestUri.length()); if (path.startsWith(REST_URL_PATTERN_BASE)) { return Resource.splitPath(path.substring(REST_URL_PATTERN_BASE.length(), path.length())); } return null; }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void destroy();  }