[
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856231#comment-13856231
]
Christian Kaltepoth commented on DELTASPIKE-399:
------------------------------------------------
@ [~johnament]:
A) Regarding the Servlet module: I think it would make sense to provide an
{{ExternalResourceProvider}} that uses {{ServletContext.getResource()}}. This
is very useful if you want to load resources that are packed in a WAR. Say you
want to load {{web.xml}} for whatever reason. You could just use:
{code}
@ExternalResource(storage="web", name="WEB-INF/web.xml")
{code}
B) I like Gerhard's idea of simply inferring the format of a Properties
resource from the file name. IMHO {{.properties}} should be the default as most
people are using this format. So we could simply use
{{Properties.loadFromXML()}} only if the name of the resource ends with
{{.xml}}. I think this is a nice example for using convention over
configuration.
C) I agree with John that using a simple string as an location identifier is
fine:
{code}
@ExternalResource(storage="classpath", name="myapp.properties")
{code}
This way uses can provide custom {{ExternalResourceProvider}} implementations
very easily. But we could provider some constants for the storage types we
provide out of the box:
{code}
@ExternalResource(storage=StorageType.CLASSPATH, name="myapp.properties")
{code}
> Incorporate Solder's ResourceLoader features into DeltaSpike
> ------------------------------------------------------------
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
> Issue Type: New Feature
> Components: Core
> Affects Versions: 0.4
> Reporter: Aaron Siri
> Assignee: John D. Ament
> Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within
> the org.jboss.solder.resourceLoader packages. With it you could do the
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
> String hostname = java.net.InetAddress.getLocalHost().getHostName();
> return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)