@Test public void testDeriveSearachNodes() throws Exception { request.setUri("/myapp", "/Environment/one/two/three"); Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/Environment/one/two/three", '/'))); request.setUri("", "/moneta/Environment"); Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/moneta/Environment", '/'))); MonetaEnvironment.getConfiguration().setIgnoredContextPathNodes(new String[]{"moneta"}); Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/Environment", '/'))); }
protected String[] deriveSearchNodes(HttpServletRequest request) { String searchUri; if (request.getContextPath() != null) { searchUri = request.getRequestURI().substring(request.getContextPath().length()); } else { searchUri = request.getRequestURI(); } String[] nodes= StringUtils.split(searchUri, '/'); if (nodes != null && nodes.length > 0 && MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes() != null) { while (ArrayUtils.contains(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes(), nodes[0])) { nodes=(String[])ArrayUtils.remove(nodes, 0); } } return nodes; }
SearchRequestFactory { protected String[] deriveSearchNodes(HttpServletRequest request) { String searchUri; if (request.getContextPath() != null) { searchUri = request.getRequestURI().substring(request.getContextPath().length()); } else { searchUri = request.getRequestURI(); } String[] nodes= StringUtils.split(searchUri, '/'); if (nodes != null && nodes.length > 0 && MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes() != null) { while (ArrayUtils.contains(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes(), nodes[0])) { nodes=(String[])ArrayUtils.remove(nodes, 0); } } return nodes; } }
SearchRequestFactory { protected String[] deriveSearchNodes(HttpServletRequest request) { String searchUri; if (request.getContextPath() != null) { searchUri = request.getRequestURI().substring(request.getContextPath().length()); } else { searchUri = request.getRequestURI(); } String[] nodes= StringUtils.split(searchUri, '/'); if (nodes != null && nodes.length > 0 && MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes() != null) { while (ArrayUtils.contains(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes(), nodes[0])) { nodes=(String[])ArrayUtils.remove(nodes, 0); } } return nodes; }  }
SearchRequestFactory { protected String[] deriveSearchNodes(HttpServletRequest request) { String searchUri; if (request.getContextPath() != null) { searchUri = request.getRequestURI().substring(request.getContextPath().length()); } else { searchUri = request.getRequestURI(); } String[] nodes= StringUtils.split(searchUri, '/'); if (nodes != null && nodes.length > 0 && MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes() != null) { while (ArrayUtils.contains(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes(), nodes[0])) { nodes=(String[])ArrayUtils.remove(nodes, 0); } } return nodes; }  SearchRequest deriveSearchRequest(HttpServletRequest request); }
SearchRequestFactory { protected String[] deriveSearchNodes(HttpServletRequest request) { String searchUri; if (request.getContextPath() != null) { searchUri = request.getRequestURI().substring(request.getContextPath().length()); } else { searchUri = request.getRequestURI(); } String[] nodes= StringUtils.split(searchUri, '/'); if (nodes != null && nodes.length > 0 && MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes() != null) { while (ArrayUtils.contains(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes(), nodes[0])) { nodes=(String[])ArrayUtils.remove(nodes, 0); } } return nodes; }  SearchRequest deriveSearchRequest(HttpServletRequest request);  }