AnsweredAssumed Answered

Messages in Java-backed web script

Question asked by nilsw on Dec 22, 2009
I would like to access the messages in <script>.<method>_<locale>.properties from a Java-backed web script. Is that possible? I have tried using MessageService.getMessage() but that didn't work. The web script declaration looks like this:

order-print.post.desc.xml:

<webscript>
  <shortname>order-print</shortname>
  <description>Document List Action - Order print</description>
  <url>/cadq/common/slingshot/doclib/action/order-print</url>
  <format default="json">argument</format>
  <authentication>user</authentication>
  <transaction>required</transaction>
</webscript>

in the same directory I have properties files

order-print.post.properties and order-print.pos_sv_SE.properties with the messages I want to use in the Java code.

Spring config:

   <!–  Java-backed Web Script: order print –>
   <bean id="webscript.com.cadq.alfresco.common.slingshot.documentlibrary.action.order-print.post"
         class="com.cadq.alfresco.common.repo.web.scripts.export.OrderPrint"
         parent="webscript">
      <property name="siteService" ref="SiteService"/>
      <property name="nodeService" ref="nodeService"/>
      <property name="fileFolderService" ref="fileFolderService"/>
      <property name="authenticationService" ref="AuthenticationService" />
      <property name="contentService" ref="ContentService"/>
      <property name="messageService" ref="messageService"/>
      <property name="personService" ref="personService" />
   </bean>

Outcomes