keycloak
静的公開メンバ関数 | 全メンバ一覧
org.keycloak.common.util.FindFile クラス
org.keycloak.common.util.FindFile 連携図
Collaboration graph

静的公開メンバ関数

static InputStream findFile (String keycloakConfigFile)
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ findFile()

static InputStream org.keycloak.common.util.FindFile.findFile ( String  keycloakConfigFile)
inlinestatic
31  {
32  if (keycloakConfigFile.startsWith(GenericConstants.PROTOCOL_CLASSPATH)) {
33  String classPathLocation = keycloakConfigFile.replace(GenericConstants.PROTOCOL_CLASSPATH, "");
34  // Try current class classloader first
35  InputStream is = FindFile.class.getClassLoader().getResourceAsStream(classPathLocation);
36  if (is == null) {
37  is = Thread.currentThread().getContextClassLoader().getResourceAsStream(classPathLocation);
38  }
39 
40  if (is != null) {
41  return is;
42  } else {
43  throw new RuntimeException("Unable to find config from classpath: " + keycloakConfigFile);
44  }
45  } else {
46  // Fallback to file
47  try {
48  return new FileInputStream(keycloakConfigFile);
49  } catch (FileNotFoundException fnfe) {
50  throw new RuntimeException(fnfe);
51  }
52  }
53  }

このクラス詳解は次のファイルから抽出されました: