Class TemplateView
java.lang.Object
io.dropwizard.views.common.View
ru.vyarus.guicey.gsp.views.template.TemplateView
- Direct Known Subclasses:
ErrorTemplateView
public class TemplateView
extends io.dropwizard.views.common.View
View template rendering model. Must be used as base class for models instead of pure
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.
- Since:
- 22.10.2018
-
Constructor Summary
ConstructorsConstructorDescriptionTemplate obtained fromTemplateannotation on resource.TemplateView(String templatePath) If template name is null, it will be obtained fromTemplateannotation on resource.TemplateView(String templatePath, Charset charset) If template name is null, it will be obtained fromTemplateannotation on resource. -
Method Summary
Modifier and TypeMethodDescriptionNote that this object is the only way to get original request path because templates are always rendered in rest endpoints after server redirect.Methods inherited from class io.dropwizard.views.common.View
getCharset, getTemplateName
-
Constructor Details
-
TemplateView
public TemplateView()Template obtained fromTemplateannotation on resource. -
TemplateView
If template name is null, it will be obtained fromTemplateannotation on resource.- Parameters:
templatePath- template path or null (to use annotation value)
-
TemplateView
If template name is null, it will be obtained fromTemplateannotation on resource.- Parameters:
templatePath- template path or null (to use annotation value)charset- charset or null
-
-
Method Details
-
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.- Returns:
- additional info about current template.
-