Package org.glassfish.jersey.server.mvc
Class Viewable
java.lang.Object
org.glassfish.jersey.server.mvc.Viewable
- Direct Known Subclasses:
ResolvedViewable
A viewable type referencing a template by name and a model to be passed
to the template. Such a type may be returned by a resource method of a
resource class. In this respect the template is the view and the controller
is the resource class in the Model View Controller pattern.
The template name may be declared as absolute template name if the name
begins with a '/', otherwise the template name is declared as a relative
template name. If the template name is relative then the class of the
last matching resource is utilized to create an absolute path by default. However,
the responsibility of resolving the absolute template name is up to
ViewableContext which can override the
default resolving behaviour.
- Author:
- Paul Sandoz, Michal Gajdos
- See Also:
-
TemplateViewableContextResolvingViewableContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetModel()Get the model.Get the template name.booleanDetermines whether the template name is represented by an absolute path.
-
Constructor Details
-
Viewable
Construct a new viewable type with a template name. The model will be set tonull.- Parameters:
templateName- the template name, shall not benull.- Throws:
IllegalArgumentException- if the template name isnull.
-
Viewable
Construct a new viewable type with a template name and a model.- Parameters:
templateName- the template name, shall not benull.model- the model, may benull.- Throws:
IllegalArgumentException- if the template name isnull.
-
-
Method Details
-
getTemplateName
Get the template name.- Returns:
- the template name.
-
getModel
Get the model.- Returns:
- the model.
-
isTemplateNameAbsolute
public boolean isTemplateNameAbsolute()Determines whether the template name is represented by an absolute path.- Returns:
trueif the template name is absolute, and starts with a '/' character,falseotherwise.
-