/** * Return the {@link org.springframework.core.io.Resource} to load the * script from. */ public final Resource getResource() { return this.resource.getResource(); }
/** * Return the {@link org.springframework.core.io.Resource} to load the * script from. */ public final Resource getResource() { return this.resource.getResource(); }
/** * Set the encoding used for reading the script resource. * <p>The default value for regular Resources is "UTF-8". * A {@code null} value implies the platform default. */ public void setEncoding(@Nullable String encoding) { this.resource = new EncodedResource(this.resource.getResource(), encoding); }
/** * Set the encoding used for reading the script resource. * <p>The default value for regular Resources is "UTF-8". * A {@code null} value implies the platform default. */ public void setEncoding(@Nullable String encoding) { this.resource = new EncodedResource(this.resource.getResource(), encoding); }
/** * Create a PropertySource having the given name based on Properties * loaded from the given encoded resource. */ public ResourcePropertySource(String name, EncodedResource resource) throws IOException { super(name, PropertiesLoaderUtils.loadProperties(resource)); this.resourceName = getNameForResource(resource.getResource()); }
/** * Create a PropertySource based on Properties loaded from the given resource. * The name of the PropertySource will be generated based on the * {@link Resource#getDescription() description} of the given resource. */ public ResourcePropertySource(EncodedResource resource) throws IOException { super(getNameForResource(resource.getResource()), PropertiesLoaderUtils.loadProperties(resource)); this.resourceName = null; }
InputStream inputStream = encodedResource.getResource().getInputStream(); try { InputSource inputSource = new InputSource(inputStream); inputSource.setEncoding(encodedResource.getEncoding()); return doLoadBeanDefinitions(inputSource, encodedResource.getResource()); "IOException parsing XML document from " + encodedResource.getResource(), ex);
/** * Create a PropertySource based on Properties loaded from the given resource. * The name of the PropertySource will be generated based on the * {@link Resource#getDescription() description} of the given resource. */ public ResourcePropertySource(EncodedResource resource) throws IOException { super(getNameForResource(resource.getResource()), PropertiesLoaderUtils.loadProperties(resource)); this.resourceName = null; }
/** * Create a PropertySource having the given name based on Properties * loaded from the given encoded resource. */ public ResourcePropertySource(String name, EncodedResource resource) throws IOException { super(name, PropertiesLoaderUtils.loadProperties(resource)); this.resourceName = getNameForResource(resource.getResource()); }
try (InputStream is = encodedResource.getResource().getInputStream()) { if (encodedResource.getEncoding() != null) { getPropertiesPersister().load(props, new InputStreamReader(is, encodedResource.getEncoding())); int count = registerBeanDefinitions(props, prefix, encodedResource.getResource().getDescription()); if (logger.isDebugEnabled()) { logger.debug("Loaded " + count + " bean definitions from " + encodedResource); throw new BeanDefinitionStoreException("Could not parse properties from " + encodedResource.getResource(), ex);
public CompensablePropertySource(String name, EncodedResource source) { super(name, source); EncodedResource encoded = (EncodedResource) this.getSource(); AbstractResource resource = (AbstractResource) encoded.getResource(); String path = resource.getFilename(); if (StringUtils.isBlank(path)) { return; } String[] values = path.split(":"); if (values.length != 2) { return; } String protocol = values[0]; String resName = values[1]; if ("bytetcc".equalsIgnoreCase(protocol) == false) { return; } else if ("loadbalancer.config".equalsIgnoreCase(resName) == false) { return; } this.enabled = true; }
InputStream inputStream = encodedResource.getResource().getInputStream(); try { InputSource inputSource = new InputSource(inputStream); inputSource.setEncoding(encodedResource.getEncoding()); return doLoadBeanDefinitions(inputSource, encodedResource.getResource()); "IOException parsing XML document from " + encodedResource.getResource(), ex);
Reader reader = null; try { String filename = resource.getResource().getFilename(); if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { stream = resource.getInputStream();
try (InputStream is = encodedResource.getResource().getInputStream()) { if (encodedResource.getEncoding() != null) { getPropertiesPersister().load(props, new InputStreamReader(is, encodedResource.getEncoding())); int count = registerBeanDefinitions(props, prefix, encodedResource.getResource().getDescription()); if (logger.isDebugEnabled()) { logger.debug("Loaded " + count + " bean definitions from " + encodedResource); throw new BeanDefinitionStoreException("Could not parse properties from " + encodedResource.getResource(), ex);
String filename = encodedResource.getResource().getFilename(); if (StringUtils.endsWithIgnoreCase(filename, ".xml")) { return this.standardXmlBeanDefinitionReader.loadBeanDefinitions(encodedResource); new Location(encodedResource.getResource()), null, ex));
Reader reader = null; try { String filename = resource.getResource().getFilename(); if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { stream = resource.getInputStream();
String filename = encodedResource.getResource().getFilename(); if (StringUtils.endsWithIgnoreCase(filename, ".xml")) { return this.standardXmlBeanDefinitionReader.loadBeanDefinitions(encodedResource); new Location(encodedResource.getResource()), null, ex));
@Override public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) { YamlMapFactoryBean factory = new YamlMapFactoryBean(); factory.setResolutionMethod(YamlProcessor.ResolutionMethod.OVERRIDE_AND_IGNORE); factory.setResources(new Resource[]{resource.getResource()}); Map<String, Object> yamlMap = factory.getObject(); String yamlStr = (new Yaml()).dump(yamlMap); yamlMap.put("environmentYamlKey", yamlStr); return new NestedMapPropertySource("servletConfigYaml", yamlMap); } }
@Override public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) { YamlMapFactoryBean factory = new YamlMapFactoryBean(); factory.setResolutionMethod(YamlProcessor.ResolutionMethod.OVERRIDE_AND_IGNORE); factory.setResources(new Resource[]{resource.getResource()}); Map<String, Object> yamlMap = factory.getObject(); String yamlStr = (new Yaml()).dump(yamlMap); yamlMap.put("environmentYamlKey", yamlStr); return new NestedMapPropertySource("servletConfigYaml", yamlMap); } }
InputStream is = encodedResource.getResource().getInputStream(); try { if (encodedResource.getEncoding() != null) { is.close(); return registerBeanDefinitions(props, prefix, encodedResource.getResource().getDescription()); throw new BeanDefinitionStoreException("Could not parse properties from " + encodedResource.getResource(), ex);