public class TemplateView
extends io.dropwizard.views.View
View.
Template name may be specified directly (within constructor) or automatically detected from Template
resource annotation. If template path starts with "/" it's considered absolute and searched directly
within classpath, otherwise template is considered relative to one of configured classpath locations.
Note that Template annotation defines templates relative to annotated class.
For error pages use ErrorTemplateView class.
| Constructor and Description |
|---|
TemplateView()
Template obtained from
Template annotation on resource. |
TemplateView(java.lang.String templatePath)
If template name is null, it will be obtained from
Template annotation on resource. |
TemplateView(java.lang.String templatePath,
java.nio.charset.Charset charset)
If template name is null, it will be obtained from
Template annotation on resource. |
| Modifier and Type | Method and Description |
|---|---|
TemplateContext |
getContext()
Note that this object is the only way to get original request path because templates are always rendered
in rest endpoints after server redirect.
|
public TemplateView()
Template annotation on resource.public TemplateView(@Nullable
java.lang.String templatePath)
Template annotation on resource.templatePath - template path or null (to use annotation value)public TemplateView(@Nullable
java.lang.String templatePath,
@Nullable
java.nio.charset.Charset charset)
Template annotation on resource.templatePath - template path or null (to use annotation value)charset - charset or nullpublic TemplateContext getContext()