|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An object instance implementing this interface is available to a velocity template layout as $context. Note that none of the methods throws a checked exception. This is to avoid the often very long and meaningless stacktraces thrown by the velocity engine. Each method will however log any errors, warnings and exceptions.
Method Summary | |
Component |
getComponent()
Retrieve the component being rendered with tis velocity template. |
java.lang.String |
getDownloadURL(java.lang.String resourceName,
java.lang.String filename)
Query the resource service for the named resource. |
java.lang.String |
getResourceURL(java.lang.String resourceName)
Query the resource service for the named resource. |
boolean |
hasChild(java.lang.String componentName)
Check if a child with the given name is available. |
void |
includeChild(java.lang.String componentName)
Search for a component in this container with the given name. |
void |
paneInclude(java.lang.String componentName)
Deprecated. see includeChild(String) |
Method Detail |
public Component getComponent()
Retrieve the component being rendered with tis velocity template. The reference can then be used from within the template.
public boolean hasChild(java.lang.String componentName)
Check if a child with the given name is available. This method can be used from within a velocity template layout for conditional inclusion of a child. It checks if the component rendered by this layout is a container and, when yes, if it contains the named child.
componentName
- the name of the child component
public void paneInclude(java.lang.String componentName)
includeChild(String)
This method is identical to includeChild(String)
and is kept
for backward compatibility. Use of this method is deprecated and a warning
will be logged on each invocation.
componentName
- the name of the child componentpublic void includeChild(java.lang.String componentName)
Search for a component in this container with the given name. When found include the rendering output of this component at the current location.
When the component being rendered is not a container or does not contain the named child, a warning will be logged and the rendering continues.
componentName
- the name of the child componentpublic java.lang.String getResourceURL(java.lang.String resourceName)
Query the resource service for the named resource. When found, it will register the resource with the render engine and return an url to retrieve the resource.
This can be used to include images or other resources in the html output without the need of instantiating an Image class for example.
Example:
<img src='$context.getResourceURL("image.png")'>
public java.lang.String getDownloadURL(java.lang.String resourceName, java.lang.String filename)
Query the resource service for the named resource. When found, it will register the resource with the render engine and return an url to retrieve the resource.
Some HTTP headers will be added so that the browser will present the user with a "Save As ..." dialog instead of showing the resource inline. Note that the browser can choose to implement this behavior differently.
Example:
<img src='$context.getDownloadURL("resources/graphics/image.png", "image.png)'>
resourceName
- the name of the resourcefilename
- the suggested filename in the browsers Save As dialog
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |