public class SpringWebFluxEngineContext extends org.thymeleaf.context.AbstractEngineContext implements org.thymeleaf.context.IEngineContext, ISpringWebFluxContext
Basic web implementation of the IEngineContext
interface, based on the Spring WebFlux
infrastructure.
This is the context implementation that will be used by default for template processing in Spring WebFlux environments. Note that this is an internal implementation, and there is no reason for users' code to directly reference or use it instead of its implemented interfaces.
This class is NOT thread-safe. Thread-safety is not a requirement for context implementations.
Constructor and Description |
---|
SpringWebFluxEngineContext(org.thymeleaf.IEngineConfiguration configuration,
org.thymeleaf.engine.TemplateData templateData,
Map<String,Object> templateResolutionAttributes,
org.springframework.web.server.ServerWebExchange exchange,
Locale locale,
Map<String,Object> variables)
Creates a new instance of this
IEngineContext implementation binding engine execution to
the Spring WebFlux request handling mechanisms, mainly modelled by ServerWebExchange . |
Modifier and Type | Method and Description |
---|---|
boolean |
containsVariable(String name) |
void |
decreaseLevel() |
List<org.thymeleaf.model.IProcessableElementTag> |
getElementStack() |
List<org.thymeleaf.model.IProcessableElementTag> |
getElementStackAbove(int contextLevel) |
org.springframework.web.server.ServerWebExchange |
getExchange()
Returns the
ServerWebExchange object associated with the template execution. |
org.thymeleaf.inline.IInliner |
getInliner() |
org.springframework.http.server.reactive.ServerHttpRequest |
getRequest()
Returns the
ServerHttpRequest object associated with the template execution. |
org.springframework.http.server.reactive.ServerHttpResponse |
getResponse()
Returns the
ServerHttpResponse object associated with the template execution. |
Object |
getSelectionTarget() |
reactor.core.publisher.Mono<org.springframework.web.server.WebSession> |
getSession()
Returns the
WebSession object associated with the template execution. |
String |
getStringRepresentationByLevel() |
org.thymeleaf.engine.TemplateData |
getTemplateData() |
List<org.thymeleaf.engine.TemplateData> |
getTemplateStack() |
Object |
getVariable(String key) |
Set<String> |
getVariableNames() |
boolean |
hasSelectionTarget() |
void |
increaseLevel() |
boolean |
isVariableLocal(String name) |
int |
level() |
void |
removeVariable(String name) |
void |
setElementTag(org.thymeleaf.model.IProcessableElementTag elementTag) |
void |
setInliner(org.thymeleaf.inline.IInliner inliner) |
void |
setSelectionTarget(Object selectionTarget) |
void |
setTemplateData(org.thymeleaf.engine.TemplateData templateData) |
void |
setVariable(String name,
Object value) |
void |
setVariables(Map<String,Object> variables) |
String |
toString() |
buildLink, getConfiguration, getExpressionObjects, getIdentifierSequences, getLocale, getMessage, getModelFactory, getTemplateMode, getTemplateResolutionAttributes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
buildLink, getIdentifierSequences, getMessage, getModelFactory, getTemplateMode, getTemplateResolutionAttributes
public SpringWebFluxEngineContext(org.thymeleaf.IEngineConfiguration configuration, org.thymeleaf.engine.TemplateData templateData, Map<String,Object> templateResolutionAttributes, org.springframework.web.server.ServerWebExchange exchange, Locale locale, Map<String,Object> variables)
Creates a new instance of this IEngineContext
implementation binding engine execution to
the Spring WebFlux request handling mechanisms, mainly modelled by ServerWebExchange
.
Note that implementations of IEngineContext
are not meant to be used in order to call
the template engine (use implementations of IContext
such as Context
or WebContext
instead). This is therefore mostly an internal implementation, and users should have no reason
to ever call this constructor except in very specific integration/extension scenarios.
configuration
- the configuration instance being used.templateData
- the template data for the template to be processed.templateResolutionAttributes
- the template resolution attributes.exchange
- the web exchange object being used for request handling.locale
- the locale.variables
- the context variables, probably coming from another IContext
implementation.public org.springframework.http.server.reactive.ServerHttpRequest getRequest()
ISpringWebFluxContext
Returns the ServerHttpRequest
object associated with the template execution.
getRequest
in interface ISpringWebFluxContext
public org.springframework.http.server.reactive.ServerHttpResponse getResponse()
ISpringWebFluxContext
Returns the ServerHttpResponse
object associated with the template execution.
getResponse
in interface ISpringWebFluxContext
public reactor.core.publisher.Mono<org.springframework.web.server.WebSession> getSession()
ISpringWebFluxContext
Returns the WebSession
object associated with the template execution.
The returned Mono
will always return an instance, either matching the client's session id
or a new session. Note that calling this method does not create the session object itself.
getSession
in interface ISpringWebFluxContext
public org.springframework.web.server.ServerWebExchange getExchange()
ISpringWebFluxContext
Returns the ServerWebExchange
object associated with the template execution.
getExchange
in interface ISpringWebFluxContext
public boolean containsVariable(String name)
containsVariable
in interface org.thymeleaf.context.IContext
public Object getVariable(String key)
getVariable
in interface org.thymeleaf.context.IContext
public Set<String> getVariableNames()
getVariableNames
in interface org.thymeleaf.context.IContext
public void setVariable(String name, Object value)
setVariable
in interface org.thymeleaf.context.IEngineContext
public void setVariables(Map<String,Object> variables)
setVariables
in interface org.thymeleaf.context.IEngineContext
public void removeVariable(String name)
removeVariable
in interface org.thymeleaf.context.IEngineContext
public boolean isVariableLocal(String name)
isVariableLocal
in interface org.thymeleaf.context.IEngineContext
public boolean hasSelectionTarget()
hasSelectionTarget
in interface org.thymeleaf.context.ITemplateContext
public Object getSelectionTarget()
getSelectionTarget
in interface org.thymeleaf.context.ITemplateContext
public void setSelectionTarget(Object selectionTarget)
setSelectionTarget
in interface org.thymeleaf.context.IEngineContext
public org.thymeleaf.inline.IInliner getInliner()
getInliner
in interface org.thymeleaf.context.ITemplateContext
public void setInliner(org.thymeleaf.inline.IInliner inliner)
setInliner
in interface org.thymeleaf.context.IEngineContext
public org.thymeleaf.engine.TemplateData getTemplateData()
getTemplateData
in interface org.thymeleaf.context.ITemplateContext
public void setTemplateData(org.thymeleaf.engine.TemplateData templateData)
setTemplateData
in interface org.thymeleaf.context.IEngineContext
public List<org.thymeleaf.engine.TemplateData> getTemplateStack()
getTemplateStack
in interface org.thymeleaf.context.ITemplateContext
public void setElementTag(org.thymeleaf.model.IProcessableElementTag elementTag)
setElementTag
in interface org.thymeleaf.context.IEngineContext
public List<org.thymeleaf.model.IProcessableElementTag> getElementStack()
getElementStack
in interface org.thymeleaf.context.ITemplateContext
public List<org.thymeleaf.model.IProcessableElementTag> getElementStackAbove(int contextLevel)
getElementStackAbove
in interface org.thymeleaf.context.IEngineContext
public int level()
level
in interface org.thymeleaf.context.IEngineContext
public void increaseLevel()
increaseLevel
in interface org.thymeleaf.context.IEngineContext
public void decreaseLevel()
decreaseLevel
in interface org.thymeleaf.context.IEngineContext
public String getStringRepresentationByLevel()
Copyright © 2017 The THYMELEAF team. All rights reserved.