当前位置: 首页>>代码示例>>Java>>正文


Java DefaultResourceLoader.getResource方法代码示例

本文整理汇总了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);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:CallbacksSecurityTests.java

示例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;
}
 
开发者ID:Acosix,项目名称:alfresco-simple-content-stores,代码行数:26,代码来源:DummyFallbackContentStore.java

示例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);

}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:BaseIoTest.java

示例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);
}
 
开发者ID:jadekler,项目名称:git-java-okta-saml-example,代码行数:9,代码来源:WebSecurityConfiguration.java

示例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);
}
 
开发者ID:jadekler,项目名称:git-java-okta-saml-example,代码行数:10,代码来源:WebSecurityConfiguration.java

示例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);
}
 
开发者ID:lhartikk,项目名称:spring-tsers-auth,代码行数:12,代码来源:WebSecurityConfig.java

示例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;
}
 
开发者ID:lhartikk,项目名称:spring-tsers-auth,代码行数:32,代码来源:WebSecurityConfig.java

示例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);
}
 
开发者ID:takesection,项目名称:spring-boot-saml2,代码行数:12,代码来源:WebSecurityConfig.java

示例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());
}
 
开发者ID:spring-projects,项目名称:spring-security-saml-dsl,代码行数:8,代码来源:SAMLConfigurer.java


注:本文中的org.springframework.core.io.DefaultResourceLoader.getResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。