本文整理匯總了Java中org.springframework.util.ResourceUtils.getURL方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceUtils.getURL方法的具體用法?Java ResourceUtils.getURL怎麽用?Java ResourceUtils.getURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.util.ResourceUtils
的用法示例。
在下文中一共展示了ResourceUtils.getURL方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureSslTrustStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private void configureSslTrustStore(SslContextFactory factory, Ssl ssl) {
if (ssl.getTrustStorePassword() != null) {
factory.setTrustStorePassword(ssl.getTrustStorePassword());
}
if (ssl.getTrustStore() != null) {
try {
URL url = ResourceUtils.getURL(ssl.getTrustStore());
factory.setTrustStoreResource(Resource.newResource(url));
}
catch (IOException ex) {
throw new EmbeddedServletContainerException(
"Could not find trust store '" + ssl.getTrustStore() + "'", ex);
}
}
if (ssl.getTrustStoreType() != null) {
factory.setTrustStoreType(ssl.getTrustStoreType());
}
if (ssl.getTrustStoreProvider() != null) {
factory.setTrustStoreProvider(ssl.getTrustStoreProvider());
}
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:22,代碼來源:JettyEmbeddedServletContainerFactory.java
示例2: configureSslKeyStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private void configureSslKeyStore(SslContextFactory factory, Ssl ssl) {
try {
URL url = ResourceUtils.getURL(ssl.getKeyStore());
factory.setKeyStoreResource(Resource.newResource(url));
}
catch (IOException ex) {
throw new EmbeddedServletContainerException(
"Could not find key store '" + ssl.getKeyStore() + "'", ex);
}
if (ssl.getKeyStoreType() != null) {
factory.setKeyStoreType(ssl.getKeyStoreType());
}
if (ssl.getKeyStoreProvider() != null) {
factory.setKeyStoreProvider(ssl.getKeyStoreProvider());
}
}
示例3: setUp
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void setUp() throws Exception
{
auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry");
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
auditComponent = (AuditComponent) ctx.getBean("auditComponent");
auditService = serviceRegistry.getAuditService();
transactionService = serviceRegistry.getTransactionService();
transactionServiceImpl = (TransactionServiceImpl) ctx.getBean("transactionService");
nodeService = serviceRegistry.getNodeService();
searchService = serviceRegistry.getSearchService();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
nodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
// Register the models
URL modelUrlMnt11072 = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-11072.xml");
URL modelUrlMnt16748 = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-16748.xml");
auditModelRegistry.registerModel(modelUrlMnt11072);
auditModelRegistry.registerModel(modelUrlMnt16748);
auditModelRegistry.loadAuditModels();
}
示例4: setup
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
@Before
public void setup() throws Exception
{
super.setup();
permissionService = applicationContext.getBean("permissionService", PermissionService.class);
authorityService = (AuthorityService) applicationContext.getBean("AuthorityService");
auditService = applicationContext.getBean("AuditService", AuditService.class);
AuditModelRegistryImpl auditModelRegistry = (AuditModelRegistryImpl) applicationContext.getBean("auditModel.modelRegistry");
// Register the test model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-access.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
}
示例5: configureSslKeyStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private void configureSslKeyStore(SslContextFactory factory, Ssl ssl) {
try {
URL url = ResourceUtils.getURL(ssl.getKeyStore());
factory.setKeyStoreResource(Resource.newResource(url));
} catch (IOException ex) {
throw new WebServerException(
"Could not find key store '" + ssl.getKeyStore() + "'", ex);
}
if (ssl.getKeyStoreType() != null) {
factory.setKeyStoreType(ssl.getKeyStoreType());
}
if (ssl.getKeyStoreProvider() != null) {
factory.setKeyStoreProvider(ssl.getKeyStoreProvider());
}
}
示例6: configureSslTrustStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private void configureSslTrustStore(final SslContextFactory factory, final Ssl ssl) {
if (ssl.getTrustStorePassword() != null) {
factory.setTrustStorePassword(ssl.getTrustStorePassword());
}
if (ssl.getTrustStore() != null) {
try {
URL url = ResourceUtils.getURL(ssl.getTrustStore());
factory.setTrustStoreResource(Resource.newResource(url));
} catch (IOException ex) {
throw new WebServerException(
"Could not find trust store '" + ssl.getTrustStore() + "'", ex);
}
}
if (ssl.getTrustStoreType() != null) {
factory.setTrustStoreType(ssl.getTrustStoreType());
}
if (ssl.getTrustStoreProvider() != null) {
factory.setTrustStoreProvider(ssl.getTrustStoreProvider());
}
}
示例7: initLogging
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
/**
* Initialize logback from the given file location, with no config file
* refreshing. Assumes an XML file in case of a ".xml" file extension, and a
* properties file otherwise.
*
* @param location the location of the config file: either a "classpath:"
* location (e.g. "classpath:mylogback.properties"), an absolute
* file URL (e.g.
* "file:C:/logback.properties), or a plain absolute path in the file system (e.g. "
* C:/logback.properties")
* @throws FileNotFoundException if the location specifies an invalid file path
*/
public static void initLogging(String location)
throws FileNotFoundException {
String resolvedLocation = SystemPropertyUtils
.resolvePlaceholders(location);
URL url = ResourceUtils.getURL(resolvedLocation);
if (resolvedLocation.toLowerCase().endsWith(XML_FILE_EXTENSION)) {
// DOMConfigurator.configure(url);
configurator.setContext(lc);
lc.reset();
try {
configurator.doConfigure(url);
} catch (JoranException ex) {
throw new FileNotFoundException(url.getPath());
}
lc.start();
}
// else {
// PropertyConfigurator.configure(url);
// }
}
示例8: doRefresh
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
@SuppressWarnings("Duplicates")
@Override
protected void doRefresh() {
Properties properties = new Properties();
for (SetariaBean.Resource resource : getSetariaBean().getResources()) {
try {
URL url = ResourceUtils.getURL(resource.getLocation());
properties.putAll(loadProperties(url));
} catch (Exception e) {
if (resource.isIgnoreNotFound()) {
LOG.info("文件 [{}] 不存在, 已忽略", resource.getLocation());
} else {
if (e instanceof FileNotFoundException) {
throw new SetariaConfigException("未發現配置文件 [" + resource.getLocation() + "]", e);
}
throw new SetariaConfigException("加載配置文件 [" + resource.getLocation() + "] 錯誤", e);
}
}
}
configProvider = new DefaultConfigProvider(properties);
}
示例9: setUp
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
@Override
public void setUp() throws Exception
{
auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry");
auditComponent = (AuditComponent) ctx.getBean("auditComponent");
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
transactionService = serviceRegistry.getTransactionService();
// Register the test model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
}
示例10: setUp
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
@Override
public void setUp() throws Exception
{
auditModelRegistry = (AuditModelRegistryImpl) ctx.getBean("auditModel.modelRegistry");
auditModelRegistry.setProperty(AuditModelRegistryImpl.PROPERTY_AUDIT_CONFIG_STRICT, Boolean.TRUE.toString());
// Register a new model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
}
示例11: loadBadModel
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private void loadBadModel(String url) throws Exception
{
try
{
URL testModelUrl = ResourceUtils.getURL(url);
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
fail("Expected model loading to fail.");
}
catch (AuditModelException e)
{
// Expected
logger.error("Expected AuditModelException: " + e.getMessage());
}
}
示例12: loadConfiguration
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
protected void loadConfiguration(String location, LogFile logFile) {
Assert.notNull(location, "Location must not be null");
try {
LoggerContext ctx = getLoggerContext();
URL url = ResourceUtils.getURL(location);
ConfigurationSource source = getConfigurationSource(url);
ctx.start(ConfigurationFactory.getInstance().getConfiguration(source));
}
catch (Exception ex) {
throw new IllegalStateException(
"Could not initialize Log4J2 logging from " + location, ex);
}
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:Log4J2LoggingSystem.java
示例13: loadKeyStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private KeyStore loadKeyStore(String type, String resource, String password)
throws Exception {
type = (type == null ? "JKS" : type);
if (resource == null) {
return null;
}
KeyStore store = KeyStore.getInstance(type);
URL url = ResourceUtils.getURL(resource);
store.load(url.openStream(), password == null ? null : password.toCharArray());
return store;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:UndertowEmbeddedServletContainerFactory.java
示例14: locate
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
/**
* 自定義加載日誌文件,初始化日誌框架
* @param logbackUrl 日誌配置文件路徑
* @throws FileNotFoundException
* @throws JoranException
*/
protected void locate(String logbackUrl) throws FileNotFoundException, JoranException {
if(Strings.isBlank(logbackUrl)) return;
logbackUrl = (logbackUrl = logbackUrl.trim()).startsWith(CLASS_PREFIX)
? logbackUrl : CLASS_PREFIX + logbackUrl;
URL url = ResourceUtils.getURL(logbackUrl);
LoggerContext loggerContext = (LoggerContext)StaticLoggerBinder.getSingleton().getLoggerFactory();
loggerContext.reset();
new ContextInitializer(loggerContext).configureByResource(url);
}
示例15: loadKeyStore
import org.springframework.util.ResourceUtils; //導入方法依賴的package包/類
private KeyStore loadKeyStore(String type, String resource, String password)
throws Exception {
type = (type == null ? "JKS" : type);
if (resource == null) {
return null;
}
KeyStore store = KeyStore.getInstance(type);
URL url = ResourceUtils.getURL(resource);
store.load(url.openStream(), password.toCharArray());
return store;
}