Powered By Blogger

Thursday, December 16, 2010

Default objects of WebScript

Alfresco webscript provides some the fields access in the ftl i,e response.
like webscript,format,args,argsM,headers,url,msg.


This is achieved in the class AbstractWebScript. That is the reason our webscript should extend the DeclarativeWebScript, DeclarativeWebScript in turn extends the AbstractWebScript.


*/
protected Map createScriptParameters(WebScriptRequest req, WebScriptResponse res, ScriptDetails script, Map customParams)
{
Map params = new HashMap(32, 1.0f);

// add web script parameters
params.put("webscript", req.getServiceMatch().getWebScript().getDescription());
params.put("format", new FormatModel(container.getFormatRegistry(), req.getFormat()));
params.put("args", createArgs(req));
params.put("argsM", createArgsM(req));
params.put("headers", createHeaders(req));
params.put("headersM", createHeadersM(req));
params.put("guest", req.isGuest());
params.put("url", new URLModel(req));
params.put("msg", getScriptMessage());

// If there is a request type specific script (e.g. *.json.js), parse
// the request according to its MIME type and add request specific
// parameters. Use the FormatReader for the generalised mime type
// corresponding to the script - not necessarily the request mime type
final String contentType = req.getContentType();

No comments:

Post a Comment