public abstract class AbstractWebScript extends Object implements WebScript
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractWebScript.ScriptDetails
The combination of a ScriptContent and a request MIME type.
|
| Constructor and Description |
|---|
AbstractWebScript() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addModuleBundleToCache(String path,
ResourceBundle bundle)
Adds a new
ResourceBundle into the cache mapped against the path
that the bundle was found. |
protected ResourceBundle |
checkModuleBundleCache(String path)
Attempts to retrieve a previously cached
ResourceBundle for the supplied
path. |
protected Map<String,String> |
createArgs(WebScriptRequest req)
Create a map of arguments from Web Script Request (for scripting)
|
protected Map<String,String[]> |
createArgsM(WebScriptRequest req)
Create a map of (array) arguments from Web Script Request (for scripting)
|
protected Map<String,String> |
createHeaders(WebScriptRequest req)
Create a map of headers from Web Script Request (for scripting)
|
protected Map<String,String[]> |
createHeadersM(WebScriptRequest req)
Create a map of (array) headers from Web Script Request (for scripting)
|
protected Map<String,Object> |
createScriptParameters(WebScriptRequest req,
WebScriptResponse res,
AbstractWebScript.ScriptDetails script,
Map<String,Object> customParams)
Create a model for script usage
|
protected WebScriptException |
createStatusException(Throwable e,
WebScriptRequest req,
WebScriptResponse res)
Create an exception whose associated message is driven from a status template and model
|
protected Map<String,Object> |
createTemplateParameters(WebScriptRequest req,
WebScriptResponse res,
Map<String,Object> customParams)
Create a model for template usage
|
protected void |
executeScript(ScriptContent location,
Map<String,Object> model)
Execute a script
|
protected Container |
getContainer() |
Description |
getDescription()
Gets the Service Description
|
protected AbstractWebScript.ScriptDetails |
getExecuteScript(String mimetype)
Find execute script for given request format
Note: This method caches the script to request format mapping
|
ResourceBundle |
getResources()
Gets the Service Resources
|
protected StatusTemplate |
getStatusTemplate(String scriptId,
int statusCode,
String format)
Find status template
Note: This method caches template search results
|
void |
init(Container container,
Description description)
Initialise a WebScript
|
protected void |
renderString(String template,
Map<String,Object> model,
Writer writer)
Render a template (contents as string)
|
protected void |
renderString(String template,
Map<String,Object> model,
Writer writer,
String extension)
Render a template (contents as string)
|
protected void |
renderTemplate(String templatePath,
Map<String,Object> model,
Writer writer)
Render a template (identified by path)
|
protected void |
sendStatus(WebScriptRequest req,
WebScriptResponse res,
Status status,
Cache cache,
String format,
Map<String,Object> model)
Render an explicit response status template
|
void |
setURLModelFactory(URLModelFactory urlModelFactory) |
String |
toString() |
public void init(Container container, Description description)
protected final Container getContainer()
public final Description getDescription()
WebScriptgetDescription in interface WebScriptprotected ResourceBundle checkModuleBundleCache(String path)
Attempts to retrieve a previously cached ResourceBundle for the supplied
path.
path - The path to retrieve a cached bundle for.null if it cannot be found.protected void addModuleBundleToCache(String path, ResourceBundle bundle)
Adds a new ResourceBundle into the cache mapped against the path
that the bundle was found.
path - The path to map the ResourceBundle against.bundle - The ResourceBundle to cache.public final ResourceBundle getResources()
WebScriptgetResources in interface WebScriptprotected AbstractWebScript.ScriptDetails getExecuteScript(String mimetype)
mimetype - Stringprotected Map<String,Object> createScriptParameters(WebScriptRequest req, WebScriptResponse res, AbstractWebScript.ScriptDetails script, Map<String,Object> customParams)
req - web script requestres - web script responsescript - script detailscustomParams - Mappublic void setURLModelFactory(URLModelFactory urlModelFactory)
setURLModelFactory in interface WebScriptprotected Map<String,Object> createTemplateParameters(WebScriptRequest req, WebScriptResponse res, Map<String,Object> customParams)
req - web script requestres - web script responsecustomParams - Mapprotected final Map<String,String> createArgs(WebScriptRequest req)
req - Web Script Requestprotected final Map<String,String[]> createArgsM(WebScriptRequest req)
req - Web Script Requestprotected final Map<String,String> createHeaders(WebScriptRequest req)
req - Web Script Requestprotected final Map<String,String[]> createHeadersM(WebScriptRequest req)
req - Web Script Requestprotected final void renderTemplate(String templatePath, Map<String,Object> model, Writer writer)
templatePath - template pathmodel - modelwriter - output writerprotected final void renderString(String template, Map<String,Object> model, Writer writer)
template - the templatemodel - modelwriter - output writerprotected final void renderString(String template, Map<String,Object> model, Writer writer, String extension)
template - the templatemodel - modelwriter - output writerextension - optional template extension type (i.e. ftl, php)protected final void sendStatus(WebScriptRequest req, WebScriptResponse res, Status status, Cache cache, String format, Map<String,Object> model) throws IOException
req - web script requestres - web script responsestatus - web script statusformat - formatmodel - modelIOExceptionprotected final WebScriptException createStatusException(Throwable e, WebScriptRequest req, WebScriptResponse res)
e - exceptionreq - web script requestres - web script responseprotected StatusTemplate getStatusTemplate(String scriptId, int statusCode, String format)
scriptId - StringstatusCode - intformat - Stringprotected void executeScript(ScriptContent location, Map<String,Object> model)
location - script locationmodel - modelCopyright © 2005–2016 Alfresco Software. All rights reserved.