/** * Set the Config Path from a String reference to a file * * @param config the config file */ public void setConfig(String config) { if (config == null) { _configPath = null; return; } try { Resource configResource = Resource.newResource(config); if (configResource instanceof JarFileResource) _configPath = extractPackedFile((JarFileResource)configResource); else if (configResource instanceof PathResource) _configPath = ((PathResource)configResource).getPath(); else if (configResource.getFile() != null) setConfigFile(configResource.getFile()); else throw new IllegalArgumentException(config); } catch (Exception e) { _configPath = null; throw new IllegalStateException(e); } }
_configPath = extractPackedFile((JarFileResource)configResource); else if (configResource instanceof PathResource) _configPath = ((PathResource)configResource).getPath(); else if (configResource.getFile() != null) setConfigFile(configResource.getFile());
@Override public boolean check(String uri, Resource resource) { // Only support PathResource alias checking if (!(resource instanceof PathResource)) return false; PathResource pathResource = (PathResource) resource; try { Path path = pathResource.getPath(); Path alias = pathResource.getAliasPath(); if (path.equals(alias)) return false; // Unknown why this is an alias if (hasSymbolicLink(path) && Files.isSameFile(path, alias)) { if (LOG.isDebugEnabled()) LOG.debug("Allow symlink {} --> {}", resource, pathResource.getAliasPath()); return true; } } catch (Exception e) { LOG.ignore(e); } return false; }
Path path = pathResource.getPath(); Path alias = pathResource.getAliasPath();