public synchronized void load() throws IOException { // parse web.xml only once because it cannot change during runtime if (roleMap != null) return; LOGGER.info("Start reloading roles for service named " + getName()); File webXML = GeoServerExtensions.file("WEB-INF/web.xml"); if (webXML == null) { throw new IOException("Cannot open /WEB-INF/web.xml"); } LOGGER.info("Extracting roles from: " + webXML.getCanonicalPath()); Set<String> roles = parseWebXML(webXML); roleMap = new HashMap<String, GeoServerRole>(); for (String role : roles) { roleMap.put(role, createRoleObject(role)); parentMappings.put(role, null); } roleSet = new TreeSet<GeoServerRole>(); roleSet.addAll(roleMap.values()); LOGGER.info("Reloading roles successful for service named " + getName()); fireRoleLoadedEvent(); }
@Test public void helperFile() { File webxml = new File("web.xml"); // we are not touching the file so anywhere is fine GeoServerExtensionsHelper.file("WEB-INF/web.xml", webxml); assertSame(webxml, GeoServerExtensions.file("WEB-INF/web.xml")); } }
if (GeoServerExtensions.file(authConfig.getAccessDeniedErrorPage()) != null) accessDeniedHandler.setErrorPage(authConfig.getAccessDeniedErrorPage()); else LOGGER.warning("Cannot find: " + authConfig.getAccessDeniedErrorPage());