本文整理了Java中freemarker.cache.WebappTemplateLoader.getURLConnectionUsesCaches()
方法的一些代码示例,展示了WebappTemplateLoader.getURLConnectionUsesCaches()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebappTemplateLoader.getURLConnectionUsesCaches()
方法的具体详情如下:
包路径:freemarker.cache.WebappTemplateLoader
类名称:WebappTemplateLoader
方法名:getURLConnectionUsesCaches
[英]Getter pair of #setURLConnectionUsesCaches(Boolean).
[中]#SetUrlConnectionUseCaches的Getter对(布尔值)。
代码示例来源:origin: org.freemarker/freemarker
public Object findTemplateSource(String name) throws IOException {
String fullPath = subdirPath + name;
if (attemptFileAccess) {
// First try to open as plain file (to bypass servlet container resource caches).
try {
String realPath = servletContext.getRealPath(fullPath);
if (realPath != null) {
File file = new File(realPath);
if (file.canRead() && file.isFile()) {
return file;
}
}
} catch (SecurityException e) {
;// ignore
}
}
// If it fails, try to open it with servletContext.getResource.
URL url = null;
try {
url = servletContext.getResource(fullPath);
} catch (MalformedURLException e) {
LOG.warn("Could not retrieve resource " + StringUtil.jQuoteNoXSS(fullPath),
e);
return null;
}
return url == null ? null : new URLTemplateSource(url, getURLConnectionUsesCaches());
}
代码示例来源:origin: org.freemarker/freemarker-gae
public Object findTemplateSource(String name) throws IOException {
String fullPath = subdirPath + name;
if (attemptFileAccess) {
// First try to open as plain file (to bypass servlet container resource caches).
try {
String realPath = servletContext.getRealPath(fullPath);
if (realPath != null) {
File file = new File(realPath);
if (file.canRead() && file.isFile()) {
return file;
}
}
} catch (SecurityException e) {
;// ignore
}
}
// If it fails, try to open it with servletContext.getResource.
URL url = null;
try {
url = servletContext.getResource(fullPath);
} catch (MalformedURLException e) {
LOG.warn("Could not retrieve resource " + StringUtil.jQuoteNoXSS(fullPath),
e);
return null;
}
return url == null ? null : new URLTemplateSource(url, getURLConnectionUsesCaches());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public Object findTemplateSource(String name) throws IOException {
String fullPath = subdirPath + name;
if (attemptFileAccess) {
// First try to open as plain file (to bypass servlet container resource caches).
try {
String realPath = servletContext.getRealPath(fullPath);
if (realPath != null) {
File file = new File(realPath);
if (file.canRead() && file.isFile()) {
return file;
}
}
} catch (SecurityException e) {
;// ignore
}
}
// If it fails, try to open it with servletContext.getResource.
URL url = null;
try {
url = servletContext.getResource(fullPath);
} catch (MalformedURLException e) {
LOG.warn("Could not retrieve resource " + StringUtil.jQuoteNoXSS(fullPath),
e);
return null;
}
return url == null ? null : new URLTemplateSource(url, getURLConnectionUsesCaches());
}
内容来源于网络,如有侵权,请联系作者删除!