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

x33g5p2x  于2022-01-24 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(180)

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

Loader.getResourceBySelfClassLoader介绍

[英]Attempt to find a resource by using the classloader that loaded this class, namely Loader.class.
[中]尝试使用加载此类的类加载器(即加载器)查找资源。班

代码示例

代码示例来源: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

URL resourceAsURL(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  if (!optional) {
   String errMsg = "Could not find resource corresponding to ["
       + resourceAttribute + "]";
   addError(errMsg);
  }
  return null;
 } else
  return url;
}

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

url = Loader.getResourceBySelfClassLoader(location);
 throw new MalformedURLException("path is required");
url = Loader.getResourceBySelfClassLoader(path);

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

/**
 * Returns the string "true" if the {@link #setResource(String) resource} specified by the
 * user is available on the class path, "false" otherwise.
 *
 * @return "true"|"false" depending on the availability of resource on the classpath
 */
public String getPropertyValue() {
 if (OptionHelper.isEmpty(resourceStr)) {
  addError("The \"resource\" property must be set.");
  return null;
 }
 URL resourceURL = Loader.getResourceBySelfClassLoader(resourceStr);
 return booleanAsStr(resourceURL != null);
}

代码示例来源: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: camunda/camunda-bpm-platform

String resource = attributes.getValue(RESOURCE_ATTRIBUTE);
resource = ec.subst(resource);
URL resourceURL = Loader.getResourceBySelfClassLoader(resource);
if (resourceURL == null) {
 addError("Could not find resource [" + resource + "].");

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

private URL resourceAsURL(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  optionalWarning("Could not find resource corresponding to ["
       + resourceAttribute + "]", null);
  return null;
 } else
  return url;
}

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

URL resourceAsURL(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  String errMsg = "Could not find resource corresponding to ["
      + resourceAttribute + "]";
  addError(errMsg);
  return null;
 } else
  return url;
}

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

URL resourceAsURL(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]");
  return null;
 } else
  return url;
}

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

URL resourceAsURL(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  String errMsg = "Could not find resource corresponding to ["
      + resourceAttribute + "]";
  addError(errMsg);
  return null;
 } else
  return url;
}

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

URL resourceAsURL(String resourceAttribute) {
  URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
  if (url == null) {
    optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]");
    return null;
  } else
    return url;
}

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

URL resourceAsURL(String resourceAttribute) {
  URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
  if (url == null) {
    optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]");
    return null;
  } else
    return url;
}

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

private InputStream getInputStreamByResource(String resourceAttribute) {
 URL url = Loader.getResourceBySelfClassLoader(resourceAttribute);
 if (url == null) {
  String errMsg = "Could not find resource corresponding to ["
    + resourceAttribute + "]";
  addError(errMsg);
  return null;
 }
 return openURL(url);
}

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

static void configureViaXML_File() {
  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  try {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();
    URL url = Loader.getResourceBySelfClassLoader("chapters/mdc/simpleMDC.xml");
    configurator.doConfigure(url);
  } catch (JoranException je) {
    StatusPrinter.print(lc);
  }
}

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

/**
 * Returns the string "true" if the {@link #setResource(String) resource} specified by the
 * user is available on the class path, "false" otherwise.
 *
 * @return "true"|"false" depending on the availability of resource on the classpath
 */
public String getPropertyValue() {
 if (OptionHelper.isEmpty(resourceStr)) {
  addError("The \"resource\" property must be set.");
  return null;
 }
 URL resourceURL = Loader.getResourceBySelfClassLoader(resourceStr);
 return booleanAsStr(resourceURL != null);
}

代码示例来源: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: 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: 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: 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: at.bestsolution.efxclipse.eclipse/ch.qos.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);
}

相关文章