當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。