Although web scripts are accessible via HTTP, their URL addressability means they can actually be hosted in a number of different environments (and therefore accessed via a protocol appropriate to the environment).
The web script architecture clearly separates the notion of a web script (that is, a unit of work) and its environment (that is, the host within which the unit of work is executed), which is known as a Web Script Runtime.
New runtimes may be plugged-in allowing web scripts to be re-used and re-hosted in a number of different applications.
Available Web Script Runtimes
Today, the following Web Script Runtimes are available:
The following initialization parameters are supported:
authenticator (optional) : the web script Authenticator as specified by its unique id. If not specified, the default JSR-168 authenticator (webscripts.authenticator.jsr168) is used.
scriptUrl : the url to the web script
JSF Runtime (JSF Component Access)
The JSF Runtime maps a JSF component to a web script.
It's configured as follows within a JSP:
<web script url>' />
The following parameters are available:
scriptUrl : the url of the web script
Authentication is handled by the Alfresco Web Client.
Developing a Web Script Runtime
A Web Script Runtime is implemented by deriving a Java class from:
This is an abstract class requiring the following methods to be implemented:
/** * Get the web script method e.g. get, post * * @return web script method */ protected abstract String getScriptMethod();
/** * Get the web script Url * * @return web script url */ protected abstract String getScriptUrl();
/** * Create a web script request * * @param match web script matching the script method and url * @return web script request */ protected abstract WebScriptRequest createRequest(WebScriptMatch match);
/** * Create a web script response * * @return web script response */ protected abstract WebScriptResponse createResponse();
/** * Authenticate web script execution * * @param required required level of authentication * @param isGuest is the request accessed as Guest * * @return true if authorised, false otherwise */ protected abstract boolean authenticate(RequiredAuthentication required, boolean isGuest);