| java.lang.Object com.ecyrd.jspwiki.modules.ModuleManager com.ecyrd.jspwiki.ui.TemplateManager
TemplateManager | public class TemplateManager extends ModuleManager (Code) | | This class takes care of managing JSPWiki templates. This class also provides
the ResourceRequest mechanism.
since: 2.1.62 author: Janne Jalkanen |
Method Summary | |
public static void | addResourceRequest(WikiContext ctx, String type, String resource) Adds a resource request to the current request context.
The content will be added at the resource-type marker
(see IncludeResourcesTag) in WikiJSPFilter.
The resources can be of different types. | public String | findJSP(PageContext pageContext, String name) An utility method for finding a JSP page. | public String | findJSP(PageContext pageContext, String template, String name) Attempts to locate a resource under the given template. | public String | findResource(WikiContext ctx, String template, String name) Attempts to locate a resource under the given template. | public static String | getMarker(WikiContext context, String type) Returns the include resources marker for a given type. | public static String[] | getResourceRequests(WikiContext ctx, String type) Returns resource requests for a particular type. | public static String[] | getResourceTypes(WikiContext ctx) Returns all those types that have been requested so far. | public Set | listSkins(PageContext pageContext, String template) Lists the skins available under this template. | public Collection | modules() Returns an empty collection, since at the moment the TemplateManager
does not manage any modules. | public boolean | templateExists(String templateName) Check the existence of a template. |
DEFAULT_TEMPLATE | final public static String DEFAULT_TEMPLATE(Code) | | The name of the default template. Value is
.
|
DIRECTORY | final public static String DIRECTORY(Code) | | The default directory for the properties. Value is
.
|
PROPERTYFILE | final public static String PROPERTYFILE(Code) | | Name of the file that contains the properties.
|
RESOURCE_HTTPHEADER | final public static String RESOURCE_HTTPHEADER(Code) | | Requests a HTTP header. Value is
.
|
RESOURCE_INCLUDES | final public static String RESOURCE_INCLUDES(Code) | | The name under which the resource includes map is stored in the WikiContext.
|
RESOURCE_INLINECSS | final public static String RESOURCE_INLINECSS(Code) | | Requests inlined CSS. Value is
.
|
RESOURCE_JSFUNCTION | final public static String RESOURCE_JSFUNCTION(Code) | | Requests a JavaScript function to be called during window.onload. Value is
.
|
RESOURCE_JSLOCALIZEDSTRINGS | final public static String RESOURCE_JSLOCALIZEDSTRINGS(Code) | | Requests a JavaScript associative array with all localized strings.
|
RESOURCE_SCRIPT | final public static String RESOURCE_SCRIPT(Code) | | Requests a script to be loaded. Value is
.
|
RESOURCE_STYLESHEET | final public static String RESOURCE_STYLESHEET(Code) | | Requests a stylesheet to be inserted. Value is
.
|
log | final protected static Logger log(Code) | | |
TemplateManager | public TemplateManager(WikiEngine engine, Properties properties)(Code) | | Creates a new TemplateManager. There is typically one manager per engine.
Parameters: engine - The owning engine. Parameters: properties - The property list used to initialize this. |
addResourceRequest | public static void addResourceRequest(WikiContext ctx, String type, String resource)(Code) | | Adds a resource request to the current request context.
The content will be added at the resource-type marker
(see IncludeResourcesTag) in WikiJSPFilter.
The resources can be of different types. For RESOURCE_SCRIPT and RESOURCE_STYLESHEET
this is an URI path to the resource (a script file or an external stylesheet)
that needs to be included. For RESOURCE_INLINECSS
the resource should be something that can be added between <style></style> in the
header file (commonheader.jsp). For RESOURCE_JSFUNCTION it is the name of the Javascript
function that should be run at page load.
The IncludeResourceTag inserts code in the template files, which is then filled
by the WikiFilter after the request has been rendered but not yet sent to the recipient.
Note that ALL resource requests get rendered, so this method does not check if
the request already exists in the resources. Therefore, if you have a plugin which
makes a new resource request every time, you'll end up with multiple resource requests
rendered. It's thus a good idea to make this request only once during the page
life cycle.
Parameters: ctx - The current wiki context Parameters: type - What kind of a request should be added? Parameters: resource - The resource to add. |
findJSP | public String findJSP(PageContext pageContext, String name)(Code) | | An utility method for finding a JSP page. It searches only under
either current context or by the absolute name.
Parameters: pageContext - the JSP PageContext Parameters: name - The name of the JSP page to look for (e.g "Wiki.jsp") The context path to the resource |
findJSP | public String findJSP(PageContext pageContext, String template, String name)(Code) | | Attempts to locate a resource under the given template. If that template
does not exist, or the page does not exist under that template, will
attempt to locate a similarly named file under the default template.
Even though the name suggests only JSP files can be located, but in fact
this method can find also other resources than JSP files.
Parameters: pageContext - The JSP PageContext Parameters: template - From which template we should seek initially? Parameters: name - Which resource are we looking for (e.g. "ViewTemplate.jsp") path to the JSP page; null, if it was not found. |
findResource | public String findResource(WikiContext ctx, String template, String name)(Code) | | Attempts to locate a resource under the given template. This matches the
functionality findJSP(), but uses the WikiContext as the argument. If there
is no servlet context (i.e. this is embedded), will just simply return
a best-guess.
This method is typically used to locate any resource, including JSP pages, images,
scripts, etc.
since: 2.6 Parameters: ctx - the wiki context Parameters: template - the name of the template to use Parameters: name - the name of the resource to fine the path to the resource |
getMarker | public static String getMarker(WikiContext context, String type)(Code) | | Returns the include resources marker for a given type. This is in a
HTML or Javascript comment format.
Parameters: wiki - context Parameters: type - the marker the generated marker comment |
getResourceRequests | public static String[] getResourceRequests(WikiContext ctx, String type)(Code) | | Returns resource requests for a particular type. If there are no resources,
returns an empty array.
Parameters: ctx - WikiContext Parameters: type - The resource request type a String array for the resource requests |
getResourceTypes | public static String[] getResourceTypes(WikiContext ctx)(Code) | | Returns all those types that have been requested so far.
Parameters: ctx - the wiki context the array of types requested |
listSkins | public Set listSkins(PageContext pageContext, String template)(Code) | | Lists the skins available under this template. Returns an
empty Set, if there are no extra skins available. Note that
this method does not check whether there is anything actually
in the directories, it just lists them. This may change
in the future.
Parameters: pageContext - the JSP PageContext Parameters: template - The template to search Set of Strings with the skin names. since: 2.3.26 |
modules | public Collection modules()(Code) | | Returns an empty collection, since at the moment the TemplateManager
does not manage any modules.
|
templateExists | public boolean templateExists(String templateName)(Code) | | Check the existence of a template.
|
|
|