To extend the capabilities of the Web Script Framework, you can develop a new kind of web script to encapsulate behavior you want to reuse across many scripted web scripts.
This example encapsulates the logic for finding a node in the content repository given a node path and placing that node into the web script model. Web scripts of this kind only have to declaratively specify the node path in their web script description for the model to automatically populate with the associated node.
-
Create the Java class for your new web script:
-
Create a Java class for extracting the node path configuration for your new
kind of web script:
-
Create the Spring Framework configuration file for registering your new web
script.
- Restart Content Services to fully register the Java-backed web script.
Your example Java class extends DeclarativeWebScript just like other Java-backed web scripts. Its primary purpose is to locate a node in the repository given a node path, which it does using the Repository service. The NodeRef returned from the Repository service is placed into the web script model under the name node.