java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.velocity.VelocityContributor
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
VelocityJavaScriptContributor
An IHeaderContributor implementation that renders a velocity template and writes it to the
response. The template is loaded via Velocity's resource loading mechanism, as defined in your
velocity.properties. If you do not have a velocity.properties for your app, it will default to a
directory "templates" in the root of your app.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Allows the behavior to detach any state it has attached during request processing.protected boolean
protected final CharSequence
evaluate()
Evaluate the template.void
renderHead
(Component component, IHeaderResponse response) Render to the web response whatever the component wants to contribute to the head section.void
setEncoding
(String encoding) Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, unbind
-
Constructor Details
-
VelocityContributor
The templateName needs to have the full path relative to where the resource loader starts looking. For example, if there is a template next to this class in the package called foo.vm, and you have configured the ClassPathResourceLoader, template name will then be "wicket/contrib/util/resource/foo.vm". Wicket provides a nice utilityPackages
for this.- Parameters:
templateName
-model
-
-
-
Method Details
-
detach
Allows the behavior to detach any state it has attached during request processing. -
getEncoding
- Returns:
- The encoding
-
renderHead
Render to the web response whatever the component wants to contribute to the head section.- Specified by:
renderHead
in interfaceIComponentAwareHeaderContributor
- Overrides:
renderHead
in classBehavior
- Parameters:
component
- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse
- Response object
-
setEncoding
- Parameters:
encoding
- The encoding
-
escapeHtml
- Returns:
- whether to escape HTML characters. The default value is false
-
evaluate
Evaluate the template.- Returns:
- The evaluated template
-