The description document describes the Folder Listing web script and a JavaScript
controller script implements its behavior. The controller establishes the folder to list from
the invoked URI and query the SkyVault content repository for that folder ensuring error
conditions are catered for.
-
Log in to SkyVault Explorer:
- Open a web browser and enter the URL: http://localhost:8080/SkyVault
- If prompted, log in with the user name admin and password admin.
- Navigate to Company Home > Data Dictionary > Web Scripts Extensions > org > example.
-
Create a web script controller script for your Folder Listing example:
- In the Create menu, click Create Content.
- Enter the name for the web script in the Name field, such as: dir.get.js
- In the Content Type list, select Plain Text.
- Click Next.
-
Type the following in the Enter Content box:
// extract folder listing arguments from URI var verbose = (args.verbose == "true" ? true : false); var folderpath = url.templateArgs.folderpath; // search for folder within SkyVault content repository var folder = roothome.childByNamePath(folderpath); // validate that folder has been found if (folder == undefined || !folder.isContainer) { status.code = 404; status.message = "Folder " + folderpath + " not found."; status.redirect = true; } // construct model for response template to render model.verbose = verbose; model.folder = folder;
- Click Next, click Finish, and then click OK.
The component script file name dir.get.js adheres to the naming
convention defined by the Web Script Framework. Your Folder Listing example now comprises the
following two component files:
- /org/example/dir.get.desc.xml
- /org/example/dir.get.js The Web Script Framework knows that both these files are related to the same web script, as they share web script package, web script ID, and HTTP method.