热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ch.qos.logback.core.util.Loader.getResource()方法的使用及代码示例

本文整理了Java中ch.qos.logback.core.util.Loader.getResource()方法的一些代码示例,展示了Loader.get

本文整理了Java中ch.qos.logback.core.util.Loader.getResource()方法的一些代码示例,展示了Loader.getResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.getResource()方法的具体详情如下:
包路径:ch.qos.logback.core.util.Loader
类名称:Loader
方法名:getResource

Loader.getResource介绍

[英]Search for a resource using the classloader passed as parameter.
[中]使用作为参数传递的classloader搜索资源。

代码示例

代码示例来源:origin: ch.qos.logback/logback-classic

private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}

代码示例来源:origin: ch.qos.logback/logback-classic

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: camunda/camunda-bpm-platform

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]",
this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: ch.qos.logback/logback-classic

private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) {
String logbackCOnfigFile= OptionHelper.getSystemProperty(CONFIG_FILE_PROPERTY);
if (logbackConfigFile != null) {
URL result = null;
try {
result = new URL(logbackConfigFile);
return result;
} catch (MalformedURLException e) {
// so, resource is not a URL:
// attempt to get the resource from the class path
result = Loader.getResource(logbackConfigFile, classLoader);
if (result != null) {
return result;
}
File f = new File(logbackConfigFile);
if (f.exists() && f.isFile()) {
try {
result = f.toURI().toURL();
return result;
} catch (MalformedURLException e1) {
}
}
} finally {
if (updateStatus) {
statusOnResourceSearch(logbackConfigFile, classLoader, result);
}
}
}
return null;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: camunda/camunda-bpm-platform

private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]",
this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: camunda/camunda-bpm-platform

private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) {
String logbackCOnfigFile= OptionHelper.getSystemProperty(CONFIG_FILE_PROPERTY);
if (logbackConfigFile != null) {
URL result = null;
try {
result = new URL(logbackConfigFile);
return result;
} catch (MalformedURLException e) {
// so, resource is not a URL:
// attempt to get the resource from the class path
result = Loader.getResource(logbackConfigFile, classLoader);
if (result != null) {
return result;
}
File f = new File(logbackConfigFile);
if (f.exists() && f.isFile()) {
try {
result = f.toURI().toURL();
return result;
} catch (MalformedURLException e1) {
}
}
} finally {
if (updateStatus) {
statusOnResourceSearch(logbackConfigFile, classLoader, result);
}
}
}
return null;
}

代码示例来源:origin: Nextdoor/bender

private URL urlByResourceName(StatusManager sm, String resourceName) {
sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
URL url = Loader.getResource(resourceName, Loader.getTCL());
if (url != null) {
return url;
}
return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: com.hynnet/logback-core

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: tony19/logback-android

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource the resource name to look for
* @return resource URL
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: Nextdoor/bender

private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: ch.qos.logback/core

/**
* Attempt to find a resource by using the classloader that loaded this class,
* namely Loader.class.
*
* @param resource
* @return
*/
public static URL getResourceBySelfClassLoader(String resource) {
return getResource(resource, getClassLoaderOfClass(Loader.class));
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

private URL getResource(String filename, ClassLoader myClassLoader, boolean updateStatus) {
URL url = Loader.getResource(filename, myClassLoader);
if (updateStatus) {
statusOnResourceSearch(filename, myClassLoader, url);
}
return url;
}

代码示例来源:origin: ch.qos.logback/logback-access

private URL searchAsResource(String filename) {
URL result = Loader.getResource(filename, getClass().getClassLoader());
if (result != null)
addInfo("Found [" + filename + "] as a resource.");
else
addInfo("Could NOT find [" + filename + "] as a resource.");
return result;
}

推荐阅读
author-avatar
Mx丶seven
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有