|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.springframework.context.support.ApplicationObjectSupport org.springframework.web.context.support.WebApplicationObjectSupport org.thymeleaf.spring4.view.AbstractThymeleafView
public abstract class AbstractThymeleafView
Abstract implementation class of the Spring MVC View
interface for Thymeleaf.
Views represent a template being executed, after being resolved (and
instantiated) by a ViewResolver
.
Field Summary | |
---|---|
static String |
DEFAULT_CONTENT_TYPE
Default charset set to ISO-8859-1 for compatibility reasons with Spring's AbstractView. |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Fields inherited from interface org.springframework.web.servlet.View |
---|
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE |
Constructor Summary | |
---|---|
protected |
AbstractThymeleafView()
Creates a new instance of ThymeleafView. |
protected |
AbstractThymeleafView(String templateName)
Creates a new instance of ThymeleafView, specifying the template name. |
Method Summary | |
---|---|
protected static void |
addRequestContextAsVariable(Map<String,Object> model,
String variableName,
org.springframework.web.servlet.support.RequestContext requestContext)
|
void |
addStaticVariable(String name,
Object value)
Add a new static variable. |
String |
getBeanName()
Returns the bean name. |
String |
getCharacterEncoding()
Returns the character encoding set to be used for rendering this view. |
String |
getContentType()
Returns the content type that will used for this view. |
protected Locale |
getLocale()
Returns the locale to be used for template processing. |
Map<String,Object> |
getStaticVariables()
Return the static variables, which will be available at the context every time this view is processed. |
protected SpringTemplateEngine |
getTemplateEngine()
Returns the template engine instance –a SpringTemplateEngine instance,
specifically– to be used for processing the template specified by this view object. |
String |
getTemplateName()
Returns the name of the template being processed by this view object. |
protected boolean |
isContentTypeSet()
|
void |
setBeanName(String beanName)
Sets the bean name. |
void |
setCharacterEncoding(String characterEncoding)
Specifies the character encoding to be set into the response when the view is rendered. |
void |
setContentType(String contentType)
Sets the content type that will used for this view. |
protected void |
setLocale(Locale locale)
Sets the locale to be used for template processing. |
void |
setStaticVariables(Map<String,?> variables)
Sets a set of static variables, which will be available at the context when this view is processed. |
protected void |
setTemplateEngine(SpringTemplateEngine templateEngine)
Sets the template engine instance –a SpringTemplateEngine instance,
specifically– to be used for processing the template specified by this view object. |
void |
setTemplateName(String templateName)
Sets the name of the template to be processed by this view object. |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
---|
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.web.servlet.View |
---|
render |
Field Detail |
---|
public static final String DEFAULT_CONTENT_TYPE
Default charset set to ISO-8859-1 for compatibility reasons with Spring's AbstractView. Value is "text/html;charset=ISO-8859-1".
Constructor Detail |
---|
protected AbstractThymeleafView()
Creates a new instance of ThymeleafView.
protected AbstractThymeleafView(String templateName)
Creates a new instance of ThymeleafView, specifying the template name.
templateName
- the template name.Method Detail |
---|
public String getContentType()
Returns the content type that will used for this view.
Content type will be computed this way:
setContentType(String)
on
this object, that value will be used.ThymeleafViewResolver.setContentType(String)
, that one will
be used.DEFAULT_CONTENT_TYPE
constant
with value "text/html;charset=ISO-8859-1" will be used.
getContentType
in interface org.springframework.web.servlet.View
ThymeleafViewResolver.getContentType()
public void setContentType(String contentType)
Sets the content type that will used for this view.
Content type will be computed this way:
ThymeleafViewResolver.setContentType(String)
, that one will
be used.DEFAULT_CONTENT_TYPE
constant
with value "text/html;charset=ISO-8859-1" will be used.
contentType
- the content type to be used.ThymeleafViewResolver.setContentType(String)
protected boolean isContentTypeSet()
public String getCharacterEncoding()
Returns the character encoding set to be used for rendering this view.
Many times, character encoding is specified as a part of the content
type using the setContentType(String)
method, but this is not mandatory,
and it could be that only the MIME type is specified that way, thus allowing
to set the character encoding using the setCharacterEncoding(String)
counterpart of this getter method.
public void setCharacterEncoding(String characterEncoding)
Specifies the character encoding to be set into the response when the view is rendered.
Many times, character encoding is specified as a part of the content
type using the setContentType(String)
method, but this is not mandatory,
and it could be that only the MIME type is specified that way, thus allowing
to set the character encoding using the setCharacterEncoding(String)
counterpart of this getter method.
characterEncoding
- the character encoding to be used (e.g. UTF-8,
ISO-8859-1, etc.)public String getBeanName()
Returns the bean name.
public void setBeanName(String beanName)
Sets the bean name.
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
beanName
- the new bean name.public String getTemplateName()
Returns the name of the template being processed by this view object.
This name will be specified in the same shape it will be resolved by the template resolvers (i.e. as it is returned by controllers, without any prefixes/suffixes).
public void setTemplateName(String templateName)
Sets the name of the template to be processed by this view object.
This name will be specified in the same shape it will be resolved by the template resolvers (i.e. as it is returned by controllers, without any prefixes/suffixes).
templateName
- the template nameprotected Locale getLocale()
Returns the locale to be used for template processing.
protected void setLocale(Locale locale)
Sets the locale to be used for template processing. Usually, the View Resolver will set this automatically from user session / application data.
locale
- the locale to be used.protected SpringTemplateEngine getTemplateEngine()
Returns the template engine instance –a SpringTemplateEngine
instance,
specifically– to be used for processing the template specified by this view object.
protected void setTemplateEngine(SpringTemplateEngine templateEngine)
Sets the template engine instance –a SpringTemplateEngine
instance,
specifically– to be used for processing the template specified by this view object.
templateEngine
- the template engine instance to be usedpublic Map<String,Object> getStaticVariables()
Return the static variables, which will be available at the context every time this view is processed.
These static variables are added to the context before the view is processed, so that they can be referenced from the context like any other context variables, for example: ${myStaticVar}.
public void addStaticVariable(String name, Object value)
Add a new static variable.
These static variables are added to the context before this view is processed, so that they can be referenced from the context like any other context variables, for example: ${myStaticVar}.
name
- the name of the static variablevalue
- the value of the static variablepublic void setStaticVariables(Map<String,?> variables)
Sets a set of static variables, which will be available at the context when this view is processed.
This method does not overwrite the existing static variables, it simply adds the ones specify to any variables already registered.
These static variables are added to the context before this view is processed, so that they can be referenced from the context like any other context variables, for example: ${myStaticVar}.
variables
- the set of variables to be added.protected static void addRequestContextAsVariable(Map<String,Object> model, String variableName, org.springframework.web.servlet.support.RequestContext requestContext) throws javax.servlet.ServletException
javax.servlet.ServletException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |