0

I have a webscript defined as following:

  • mywebscript.get.desc.xml
  • mywebscript.get.properties
  • mywebscript.get.json.ftl

This webscript is backed by a java controller like this:

<bean id="webscript.mypackage.mywebscript.get"
    class="javapackage.MyWebscriptGet" parent="webscript">
    <property name="serviceRegistry" ref="ServiceRegistry" />
    <property name="messageService" ref="messageService" />
</bean>

I can't retrieve in java code some properties defined in "mywebscript.get.properties", I tried to use the messageService and I18nUtil.getMessage, but it seems that other properties are loaded, but the ones that i need are not.

Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
alaeddine.nasri
  • 182
  • 1
  • 2
  • 11

1 Answers1

3

The resources in the webscriptname.get.properties files aren't available via the Message Service or I18NUtil. The latter two are globally scoped, while the webscript properties are specific to just that WebScript. To get them, you need to work with the WebScript definition.

In Java, that means doing something like:

protected Map<String, Object> executeImpl(WebScriptRequest req,
      Status status, Cache cache) 
{
   Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
   WebScript webscript = req.getServiceMatch().getWebScript();
   ResourceBundle webscriptRB = webscript.getResources();

   ....
}

From the WebScriptRequest get the Match, from there get the WebScript, and that will give you the webscript specific properties as a ResourceBundle

Gagravarr
  • 47,320
  • 10
  • 111
  • 156