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.ViewView template rendering model. Must be used as base class for models instead of pureView.Template name may be specified directly (within constructor) or automatically detected from
Templateresource 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 thatTemplateannotation defines templates relative to annotated class.For error pages use
ErrorTemplateViewclass.- Since:
- 22.10.2018
-
-
Constructor Summary
Constructors Constructor Description TemplateView()Template obtained fromTemplateannotation on resource.TemplateView(java.lang.String templatePath)If template name is null, it will be obtained fromTemplateannotation on resource.TemplateView(java.lang.String templatePath, java.nio.charset.Charset charset)If template name is null, it will be obtained fromTemplateannotation on resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateContextgetContext()Note that this object is the only way to get original request path because templates are always rendered in rest endpoints after server redirect.
-
-
-
Constructor Detail
-
TemplateView
public TemplateView()
Template obtained fromTemplateannotation on resource.
-
TemplateView
public TemplateView(@Nullable java.lang.String templatePath)If template name is null, it will be obtained fromTemplateannotation on resource.- Parameters:
templatePath- template path or null (to use annotation value)
-
TemplateView
public TemplateView(@Nullable java.lang.String templatePath, @Nullable java.nio.charset.Charset charset)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 Detail
-
getContext
public 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.- Returns:
- additional info about current template.
-
-