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 repository for that folder ensuring error conditions are catered
for.
-
Log in to SkyVault Share:
- Open a web browser and enter the URL: http://localhost:8080/share
- If prompted, log in with the user name admin and password admin.
- Navigate to Data Dictionary > Web Scripts Extensions > org > example.
-
Create a web script controller script for your Folder Listing example:
- In the Create menu, select Plain Text.
- Enter the name for the web script in the Name field: dir.get.js
-
Type the following in the 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 Create.
- Navigate back to the org/example folder using the breadcrumb trail.
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.