本文整理汇总了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());
}