本文整理了Java中org.geoserver.platform.resource.Files.url()
方法的一些代码示例,展示了Files.url()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Files.url()
方法的具体详情如下:
包路径:org.geoserver.platform.resource.Files
类名称:Files
方法名:url
暂无
代码示例来源:origin: geoserver/geoserver
/** @deprecated use {@link Resources#fromURL(Resource, String)} */
@Deprecated
public File url(String url) {
return Files.url(baseDirectory, url);
}
代码示例来源:origin: org.geoserver.web/gs-web-core
public void setObject(String location) {
if (location != null) {
File dataDirectory = canonicalize(rootDir);
File file = canonicalize(new File(location));
if (isSubfile(dataDirectory, file)) {
File curr = file;
String path = null;
// paranoid check to avoid infinite loops
while (curr != null && !curr.equals(dataDirectory)) {
if (path == null) {
path = curr.getName();
} else {
path = curr.getName() + "/" + path;
}
curr = curr.getParentFile();
}
location = "file:" + path;
} else {
File dataFile = Files.url(rootDir, location);
if (dataFile != null && !dataFile.equals(file)) {
// relative to the data directory, does not need fixing
} else {
location = "file://" + file.getAbsolutePath();
}
}
}
delegate.setObject(location);
}
代码示例来源:origin: org.geoserver.importer/gs-importer-core
/**
* Converts an absolute URL to a resource to be relative to the data directory if applicable.
*
* @return The relative path, or the original path if it does not contain the data directory
*/
protected String relativeDataFileURL(String url, Catalog catalog) {
if (catalog == null) {
return url;
}
File baseDirectory = catalog.getResourceLoader().getBaseDirectory();
File f = Files.url(baseDirectory, url);
return f == null ? url : "file:" + Paths.convert(baseDirectory, f);
}
代码示例来源:origin: org.geoserver.web/gs-web-core
if (baseDirectory != null) {
relFile = Files.url(baseDirectory, uriSpec);
} else if (loader != null) {
内容来源于网络,如有侵权,请联系作者删除!