wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warren Bell <warr...@clarksnutrition.com>
Subject Re: How do I access Wicket's string resources in a non component class ?
Date Wed, 11 Dec 2013 22:39:39 GMT
Answered my own question. Found this in Wicket REST Annotation tests. 

DefaultBundleResolver resolver = new DefaultBundleResolver(RestResourceFullAnnotated.class);

                assertEquals(resolver.getMessage("CustomValidator", Collections.EMPTY_MAP),
response);


On Dec 11, 2013, at 2:26 PM, Warren Bell wrote:

> I think this is exactly what I am looking for. I had an older version of Wicket REST
Annotations that did not have this class.
> 
> I do have a question about its usage. I did the following in my resource class and it
does work.
> 
> DefaultBundleResolver  defaultBundleResolver = new DefaultBundleResolver(MyRestResource.class);
> String message = defaultBundleResolver.getMessage("test", null);
> 
> Is this the correct way to use this class or is their a way for it to plug into Wicket
via Application#Init() method and then get the Localizer and use it?
> 
> Thanks,
> 
> Warren
> 
> 
> On Dec 11, 2013, at 1:30 PM, Andrea Del Bene wrote:
> 
>> Hi,
>> 
>> maybe you can have a look here: https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/wicketstuff-restannotations-parent/restannotations/src/main/java/org/wicketstuff/rest/utils/wicket/bundle/DefaultBundleResolver.java
>> 
>> That's a resource bundle resolver that works with the stringResourceLoaders of the
Application.
>>> I want to access Wicket's string resources in a non component class. I am aware
of getLocalizer().getString(...) for a component, but how do you do this in a non Component
based class and how do you make Wicket aware of the message bundle ? All of the Localizer#getString(...)
methods require a Component. I am using Wicket version 6.10.0. I have a REST resource named
UserResource.java and messages in UserResource.properties.
>>> 
>>> Thanks
>>> 
>>> Warren
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> -- 
>> This email was Virus checked by Clark's Nutrition's Astaro Security Gateway.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message