本文整理匯總了Java中org.springframework.core.io.DefaultResourceLoader.getResource方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultResourceLoader.getResource方法的具體用法?Java DefaultResourceLoader.getResource怎麽用?Java DefaultResourceLoader.getResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.core.io.DefaultResourceLoader
的用法示例。
在下文中一共展示了DefaultResourceLoader.getResource方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
final ProtectionDomain empty = new ProtectionDomain(null,
new Permissions());
provider = new SecurityContextProvider() {
private final AccessControlContext acc = new AccessControlContext(
new ProtectionDomain[] { empty });
@Override
public AccessControlContext getAccessControlContext() {
return acc;
}
};
DefaultResourceLoader drl = new DefaultResourceLoader();
Resource config = drl
.getResource("/org/springframework/beans/factory/support/security/callbacks.xml");
beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(config);
beanFactory.setSecurityContextProvider(provider);
}
示例2: getDummyFileResource
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
protected Resource getDummyFileResource(final String mimetype)
{
final String extension = this.mimetypeService.getExtension(mimetype);
Resource resource = null;
final List<String> pathsToSearch = new ArrayList<>(this.dummyFilePaths);
Collections.reverse(pathsToSearch);
final DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
for (final String path : pathsToSearch)
{
resource = resourceLoader.getResource(path + "/dummy." + extension);
if (resource != null)
{
if (resource.exists())
{
break;
}
// nope'd
resource = null;
}
}
LOGGER.trace("Found dummy file resource {} for extension {}", resource, extension);
return resource;
}
示例3: onSetUp
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
protected void onSetUp() throws Exception {
// load file using absolute path
defaultLoader = new DefaultResourceLoader();
thisClass = defaultLoader.getResource(getClass().getName().replace('.', '/').concat(".class"));
bundle = bundleContext.getBundle();
loader = new OsgiBundleResourceLoader(bundle);
patternLoader = new OsgiBundleResourcePatternResolver(loader);
}
示例4: pivotalTestMetadataProvider
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Bean
public FilesystemMetadataProvider pivotalTestMetadataProvider() throws IOException, MetadataProviderException {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader.getResource("classpath:/saml/colombia-metadata.xml");
File oktaMetadata = storeFile.getFile();
return new FilesystemMetadataProvider(oktaMetadata);
}
示例5: keyManager
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Bean
public KeyManager keyManager() {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader.getResource("classpath:/saml/colombia.jks");
Map<String, String> passwords = new HashMap<>();
passwords.put("colombia", "colombia-password");
String defaultKey = "colombia";
return new JKSKeyManager(storeFile, "colombia-password", passwords, defaultKey);
}
示例6: keyManager
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Bean
public KeyManager keyManager() {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader
.getResource("classpath:/saml/samlKeystore.jks");
String storePass = "nalle123";
Map<String, String> passwords = new HashMap<String, String>();
passwords.put("apollo", "nalle123");
String defaultKey = "apollo";
return new JKSKeyManager(storeFile, storePass, passwords, defaultKey);
}
示例7: ssoCircleExtendedMetadataProvider
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Bean
@Qualifier("idp-ssocircle")
public ExtendedMetadataDelegate ssoCircleExtendedMetadataProvider()
throws MetadataProviderException {
AbstractMetadataProvider provider = new AbstractMetadataProvider() {
@Override
protected XMLObject doGetMetadata() throws MetadataProviderException {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader.getResource("classPath:/saml/idp-metadata.xml");
ParserPool parser = parserPool();
try {
Document mdDocument = parser.parse(storeFile.getInputStream());
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(mdDocument.getDocumentElement());
return unmarshaller.unmarshall(mdDocument.getDocumentElement());
} catch (Exception e) {
e.printStackTrace();
throw new MetadataProviderException();
}
}
};
ExtendedMetadataDelegate extendedMetadataDelegate =
new ExtendedMetadataDelegate(provider, extendedMetadata());
extendedMetadataDelegate.setMetadataTrustCheck(false);
extendedMetadataDelegate.setMetadataRequireSignature(false);
return extendedMetadataDelegate;
}
示例8: keyManager
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
@Bean
public KeyManager keyManager() {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader
.getResource(properties.getStoreFile());
String storePass = properties.getStorePass();
Map<String, String> passwords = new HashMap<>();
passwords.put(properties.getDefaultKey(), properties.getPassword());
String defaultKey = properties.getDefaultKey();
return new JKSKeyManager(storeFile, storePass, passwords, defaultKey);
}
示例9: keyManager
import org.springframework.core.io.DefaultResourceLoader; //導入方法依賴的package包/類
private KeyManager keyManager() {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource storeFile = loader.getResource(keyStore.getStoreFilePath());
Map<String, String> passwords = new HashMap<>();
passwords.put(keyStore.getKeyname(), keyStore.getKeyPassword());
return new JKSKeyManager(storeFile, keyStore.getPassword(), passwords, keyStore.getKeyname());
}