private DirectoryIndexDescriptor loadDirectoryIndexResource(final String path) { String normalizedDirectoryPath = pathHelper.getNormalizedDirectoryPath(path); for (String index : serverConfig.getDirectoryIndex()) { String directoryIndexPath = normalizedDirectoryPath + index; ResourceProvider resourceProvider = getResourceProvider(directoryIndexPath); if (resourceProvider != null) { return new DirectoryIndexDescriptor(resourceProvider, directoryIndexPath); } } return null; }
@Test public void shouldNormalizeDirectoryPath() { assertThat(pathHelper.getNormalizedDirectoryPath("somepath"), is("somepath/")); assertThat(pathHelper.getNormalizedDirectoryPath("somepath/"), is("somepath/")); }