You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2012/01/30 02:45:11 UTC
contributeSymbolSource doesn't always work for me?
Hi all,
I've seen in a few examples and posts that the way to configure tapestry
from a properties file is to use contributeSymbolSource. I would like to
configure tapestry firstly from a properties file and secondly hard-set
a couple of values from AppModule.
I am doing the following:
public static void
contributeSymbolSource(OrderedConfiguration<SymbolProvider> providers)
{
providers.add("tapestryConfiguration", new
ClasspathResourceSymbolProvider("tapestry.properties"));
providers.add("applicationConfiguration", new
ClasspathResourceSymbolProvider("application.properties"));
}
public static void
contributeApplicationDefaults(MappedConfiguration<String, Object>
configuration)
{
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
}
public static void
contributeFactoryDefaults(MappedConfiguration<String, Object> configuration)
{
configuration.override(SymbolConstants.APPLICATION_VERSION,
MAJOR_VERSION + "." + MINOR_VERSION);
configuration.override(SymbolConstants.COMPRESS_WHITESPACE,
"false");
configuration.override(SymbolConstants.MINIFICATION_ENABLED,
"false");
}
I have triple checked that the content of 'tapestry.properties' on the
classpath is:
tapestry.production-mode=false
tapestry.file-check-interval=10 s
This is the value of the files in 'target/classes' as well as
'target/[project]/WEB-INF/classes'.
However, when I print out the symbol values on one of my pages I get:
tapestry.production-mode: true
tapestry.compress-whitespace: false
tapestry.combine-scripts: true
tapestry.compact-json: true
tapestry.enable-minification: false
tapestry.file-check-interval: 1 s
The obvious conclusion would be that the SybolProvider is not being
used/loaded, however I do not see any exceptions in the logs.
And then, after a number of restarts deleting the 'target' directory
each time, the correct settings are read.
Is there anything obviously wrong with what I'm doing, or some cache I
need to be deleting?
Thanks, Paul.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: contributeSymbolSource doesn't always work for me?
Posted by Paul Stanton <pa...@mapshed.com.au>.
Thiago,
I've tested with "after:*" and it fails every time, and with "before:*"
it succeeds every time.
I guess I should have read
http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile#Tying_it_together
since the recommended "after:SystemProperties",
"before:ApplicationDefaults" also works perfectly.
Thanks again for the hint.
I think I modelled this originally from the Wookie project
(https://github.com/spreadthesource/wooki/blob/master/src/main/java/com/wooki/services/WookiModule.java)
but there are multiple other posts floating around with this apparent
misconfiguration.
Cheers, p.
On 30/01/2012 3:48 PM, Paul Stanton wrote:
> Hi Thiago,
>
> I assume you mean on my SymbolSource contribution for
> 'tapestry.properties' .. Which should it be?
>
> "before:*" so that it gets loaded first (to initialise correctly), or
> "after:*" so it gets loaded last (to override other settings)
>
> Since I'm getting kind of inconsistent behaviour, I am unsure how to
> test this.
>
> Thanks, Paul.
>
> On 30/01/2012 1:00 PM, Thiago H. de Paula Figueiredo wrote:
>> Hi!
>>
>> Have you tried ordering (adding "before:*" or "after:*" in your
>> contributions? It's an OrderedConfiguration, so order matters.
>> Without specifying order constraints, there's no guaranteed
>> contribution order.
>>
>> On Sun, 29 Jan 2012 23:45:11 -0200, Paul Stanton
>> <pa...@mapshed.com.au> wrote:
>>
>>> Hi all,
>>>
>>> I've seen in a few examples and posts that the way to configure
>>> tapestry from a properties file is to use contributeSymbolSource. I
>>> would like to configure tapestry firstly from a properties file and
>>> secondly hard-set a couple of values from AppModule.
>>>
>>> I am doing the following:
>>>
>>> public static void
>>> contributeSymbolSource(OrderedConfiguration<SymbolProvider> providers)
>>> {
>>> providers.add("tapestryConfiguration", new
>>> ClasspathResourceSymbolProvider("tapestry.properties"));
>>> providers.add("applicationConfiguration", new
>>> ClasspathResourceSymbolProvider("application.properties"));
>>> }
>>>
>>> public static void
>>> contributeApplicationDefaults(MappedConfiguration<String, Object>
>>> configuration)
>>> {
>>> configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
>>> }
>>>
>>> public static void
>>> contributeFactoryDefaults(MappedConfiguration<String, Object>
>>> configuration)
>>> {
>>> configuration.override(SymbolConstants.APPLICATION_VERSION,
>>> MAJOR_VERSION + "." + MINOR_VERSION);
>>> configuration.override(SymbolConstants.COMPRESS_WHITESPACE,
>>> "false");
>>>
>>> configuration.override(SymbolConstants.MINIFICATION_ENABLED, "false");
>>> }
>>>
>>> I have triple checked that the content of 'tapestry.properties' on
>>> the classpath is:
>>>
>>> tapestry.production-mode=false
>>> tapestry.file-check-interval=10 s
>>>
>>> This is the value of the files in 'target/classes' as well as
>>> 'target/[project]/WEB-INF/classes'.
>>>
>>> However, when I print out the symbol values on one of my pages I get:
>>>
>>> tapestry.production-mode: true
>>> tapestry.compress-whitespace: false
>>> tapestry.combine-scripts: true
>>> tapestry.compact-json: true
>>> tapestry.enable-minification: false
>>> tapestry.file-check-interval: 1 s
>>>
>>> The obvious conclusion would be that the SybolProvider is not being
>>> used/loaded, however I do not see any exceptions in the logs.
>>>
>>> And then, after a number of restarts deleting the 'target' directory
>>> each time, the correct settings are read.
>>>
>>> Is there anything obviously wrong with what I'm doing, or some cache
>>> I need to be deleting?
>>>
>>> Thanks, Paul.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: contributeSymbolSource doesn't always work for me?
Posted by Paul Stanton <pa...@mapshed.com.au>.
Hi Thiago,
I assume you mean on my SymbolSource contribution for
'tapestry.properties' .. Which should it be?
"before:*" so that it gets loaded first (to initialise correctly), or
"after:*" so it gets loaded last (to override other settings)
Since I'm getting kind of inconsistent behaviour, I am unsure how to
test this.
Thanks, Paul.
On 30/01/2012 1:00 PM, Thiago H. de Paula Figueiredo wrote:
> Hi!
>
> Have you tried ordering (adding "before:*" or "after:*" in your
> contributions? It's an OrderedConfiguration, so order matters. Without
> specifying order constraints, there's no guaranteed contribution order.
>
> On Sun, 29 Jan 2012 23:45:11 -0200, Paul Stanton <pa...@mapshed.com.au>
> wrote:
>
>> Hi all,
>>
>> I've seen in a few examples and posts that the way to configure
>> tapestry from a properties file is to use contributeSymbolSource. I
>> would like to configure tapestry firstly from a properties file and
>> secondly hard-set a couple of values from AppModule.
>>
>> I am doing the following:
>>
>> public static void
>> contributeSymbolSource(OrderedConfiguration<SymbolProvider> providers)
>> {
>> providers.add("tapestryConfiguration", new
>> ClasspathResourceSymbolProvider("tapestry.properties"));
>> providers.add("applicationConfiguration", new
>> ClasspathResourceSymbolProvider("application.properties"));
>> }
>>
>> public static void
>> contributeApplicationDefaults(MappedConfiguration<String, Object>
>> configuration)
>> {
>> configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
>> }
>>
>> public static void
>> contributeFactoryDefaults(MappedConfiguration<String, Object>
>> configuration)
>> {
>> configuration.override(SymbolConstants.APPLICATION_VERSION,
>> MAJOR_VERSION + "." + MINOR_VERSION);
>> configuration.override(SymbolConstants.COMPRESS_WHITESPACE,
>> "false");
>> configuration.override(SymbolConstants.MINIFICATION_ENABLED,
>> "false");
>> }
>>
>> I have triple checked that the content of 'tapestry.properties' on
>> the classpath is:
>>
>> tapestry.production-mode=false
>> tapestry.file-check-interval=10 s
>>
>> This is the value of the files in 'target/classes' as well as
>> 'target/[project]/WEB-INF/classes'.
>>
>> However, when I print out the symbol values on one of my pages I get:
>>
>> tapestry.production-mode: true
>> tapestry.compress-whitespace: false
>> tapestry.combine-scripts: true
>> tapestry.compact-json: true
>> tapestry.enable-minification: false
>> tapestry.file-check-interval: 1 s
>>
>> The obvious conclusion would be that the SybolProvider is not being
>> used/loaded, however I do not see any exceptions in the logs.
>>
>> And then, after a number of restarts deleting the 'target' directory
>> each time, the correct settings are read.
>>
>> Is there anything obviously wrong with what I'm doing, or some cache
>> I need to be deleting?
>>
>> Thanks, Paul.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: contributeSymbolSource doesn't always work for me?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Hi!
Have you tried ordering (adding "before:*" or "after:*" in your
contributions? It's an OrderedConfiguration, so order matters. Without
specifying order constraints, there's no guaranteed contribution order.
On Sun, 29 Jan 2012 23:45:11 -0200, Paul Stanton <pa...@mapshed.com.au>
wrote:
> Hi all,
>
> I've seen in a few examples and posts that the way to configure tapestry
> from a properties file is to use contributeSymbolSource. I would like to
> configure tapestry firstly from a properties file and secondly hard-set
> a couple of values from AppModule.
>
> I am doing the following:
>
> public static void
> contributeSymbolSource(OrderedConfiguration<SymbolProvider> providers)
> {
> providers.add("tapestryConfiguration", new
> ClasspathResourceSymbolProvider("tapestry.properties"));
> providers.add("applicationConfiguration", new
> ClasspathResourceSymbolProvider("application.properties"));
> }
>
> public static void
> contributeApplicationDefaults(MappedConfiguration<String, Object>
> configuration)
> {
> configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
> }
>
> public static void
> contributeFactoryDefaults(MappedConfiguration<String, Object>
> configuration)
> {
> configuration.override(SymbolConstants.APPLICATION_VERSION,
> MAJOR_VERSION + "." + MINOR_VERSION);
> configuration.override(SymbolConstants.COMPRESS_WHITESPACE,
> "false");
> configuration.override(SymbolConstants.MINIFICATION_ENABLED,
> "false");
> }
>
> I have triple checked that the content of 'tapestry.properties' on the
> classpath is:
>
> tapestry.production-mode=false
> tapestry.file-check-interval=10 s
>
> This is the value of the files in 'target/classes' as well as
> 'target/[project]/WEB-INF/classes'.
>
> However, when I print out the symbol values on one of my pages I get:
>
> tapestry.production-mode: true
> tapestry.compress-whitespace: false
> tapestry.combine-scripts: true
> tapestry.compact-json: true
> tapestry.enable-minification: false
> tapestry.file-check-interval: 1 s
>
> The obvious conclusion would be that the SybolProvider is not being
> used/loaded, however I do not see any exceptions in the logs.
>
> And then, after a number of restarts deleting the 'target' directory
> each time, the correct settings are read.
>
> Is there anything obviously wrong with what I'm doing, or some cache I
> need to be deleting?
>
> Thanks, Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org