Configuring webscript linked to Alfresco, can it be loaded into an E4X object?

I want to use the copied config file in the Alfresco JavaScript file. I started from this wiki page and it got me mostly there.

This jira page told me that I need to create a spring-webscripts-config-custom.xml file and place it in META-INF, that is, / shared / classes / META-INF / spring-webscripts-config-custom.xml. Good. It works. I can upload the file and view the configuration using the methods listed on the Jira page.

But these methods are a pain to use (childrenMap and getChild) and I would rather use E4X to parse and query the XML config file. To do this, I will need to get the config file as a string and pass it to

var conf = new XML (configStr);

Any ideas on how I can go about doing this?

And a good E4X tutorial page

+3


source to share


1 answer


There IMHO there is no way to achieve what you are describing with a JS backed web script. You will need to implement a Java controller to access the config file and send it to the client.

However, exposing their content to the outside world is not really what Alfresco's config files are for. If you can reveal more details about what you are trying to achieve, it might be easier to suggest some appropriate ways to display configuration data to the client.


EDIT



After the scope has been clarified, I want to offer your website script a custom XML configuration file containing all the mapping between error codes and messages. As explained in the docs , let's assume your web script is defined in myscript.get.desc.xml

. Then you can create a file named myscript.get.config.xml

that contains, for example:

<messages>
  <message>
    <id>1</id>
    <desc>A long description here</desc>
  </message>
</messages>

      

Then you can parse a configuration like this in your JS controller myscript.get.js

:

var myconfig = new XML(config.script);

      

+2


source







All Articles