Class ThymeleafEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.api.management.mbean.ManagedResourceEndpointMBean,org.apache.camel.CamelContextAware,org.apache.camel.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
-
Field Summary
Fields inherited from class org.apache.camel.component.ResourceEndpoint
logFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionThymeleafEndpoint(String endpointURI, org.apache.camel.Component component, String resourceURI) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected StringfindOrCreateEndpoint(String uri, String newResourceUri) org.apache.camel.ExchangePatterngetOrder()protected org.thymeleaf.TemplateEnginebooleanbooleanisRemote()protected voidonExchange(org.apache.camel.Exchange exchange) voidsetAllowTemplateFromHeader(boolean allowTemplateFromHeader) Whether to allow to use resource template from header or not (default false).voidsetCacheable(Boolean cacheable) Sets a new value for the cacheable flag.voidsetCacheTimeToLive(Long cacheTimeToLive) Sets a new value for the cache TTL for resolved templates.voidsetCheckExistence(Boolean checkExistence) Sets whether template resources will be checked for existence before being returned or not.voidsetEncoding(String encoding) Sets a new character encoding for reading template resources.voidsetJakartaServletWebApplication(org.thymeleaf.web.servlet.JakartaServletWebApplication jakartaServletWebApplication) voidSets a new order for the template engine in the chain.voidSets a new (optional) prefix to be added to all template names in order to convert template names into resource names.voidsetResolver(ThymeleafResolverType resolver) Sets the type of resolver to be used by the template engine.voidSets a new (optional) suffix to be added to all template names in order to convert template names into resource names.voidsetTemplate(String template) voidsetTemplateEngine(org.thymeleaf.TemplateEngine templateEngine) To use theTemplateEngineotherwise a new engine is createdvoidsetTemplateMode(String templateMode) Sets the template mode to be applied to templates resolved by this endpoint.Methods inherited from class org.apache.camel.component.ResourceEndpoint
getCamelId, getCamelManagementName, getResourceAsInputStream, getResourceAsInputStreamWithoutCache, getResourceUri, getState, isAllowContextMapAll, isContentCache, isContentCacheCleared, loadResource, setAllowContextMapAll, setContentCache, setResourceUriMethods inherited from class org.apache.camel.support.ProcessorEndpoint
createPollingConsumer, createProcessor, createProducer, getProcessor, setProcessorMethods inherited from class org.apache.camel.support.DefaultPollingEndpoint
createConsumerMethods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelayMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createExchange, createExchange, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponentMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducerMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
ThymeleafEndpoint
public ThymeleafEndpoint() -
ThymeleafEndpoint
-
-
Method Details
-
isRemote
public boolean isRemote() -
getExchangePattern
public org.apache.camel.ExchangePattern getExchangePattern()- Specified by:
getExchangePatternin interfaceorg.apache.camel.Endpoint- Overrides:
getExchangePatternin classorg.apache.camel.support.DefaultEndpoint
-
createEndpointUri
- Overrides:
createEndpointUriin classorg.apache.camel.support.DefaultEndpoint
-
getTemplateMode
-
setTemplateMode
Sets the template mode to be applied to templates resolved by this endpoint.
One of
HTML,XML,TEXT,JAVASCRIPT,CSS,RAW.Note that this template mode will be ignored if the template resource name ends in a known file name suffix:
.html,.htm,.xhtml,.xml,.js,.json,.css,.rss,.atom,.txt.- Parameters:
templateMode- the template mode.
-
getResolver
-
setResolver
Sets the type of resolver to be used by the template engine.One of
CLASS_LOADER,DEFAULT,FILE,STRING,URL,WEB_APP. -
getPrefix
-
setPrefix
Sets a new (optional) prefix to be added to all template names in order to convert template names into resource names.
- Parameters:
prefix- the prefix to be set.
-
getSuffix
-
setSuffix
Sets a new (optional) suffix to be added to all template names in order to convert template names into resource names.
Note that this suffix may not be applied to the template name if the template name already ends in a known file name suffix:
.html,.htm,.xhtml,.xml,.js,.json,.css,.rss,.atom,.txt.- Parameters:
suffix- the suffix to be set.
-
getEncoding
-
setEncoding
Sets a new character encoding for reading template resources.- Parameters:
encoding- the character encoding to be used.
-
getOrder
-
setOrder
Sets a new order for the template engine in the chain. Order should start with 1.- Parameters:
order- the new order.
-
getCheckExistence
-
setCheckExistence
Sets whether template resources will be checked for existence before being returned or not. Default value isFALSE.- Parameters:
checkExistence-trueif resource existence should be checked,falseif not
-
getCacheTimeToLive
-
setCacheTimeToLive
Sets a new value for the cache TTL for resolved templates. If a template is resolved as cacheable but cache TTL is null, this means the template will live in cache until evicted by LRU (Least Recently Used) algorithm for being the oldest entry in cache.- Parameters:
cacheTimeToLive- the new cache TTL in milliseconds, or null for using natural LRU eviction.
-
getCacheable
-
setCacheable
Sets a new value for the cacheable flag.- Parameters:
cacheable- whether resolved patterns should be considered cacheable or not.
-
isAllowTemplateFromHeader
public boolean isAllowTemplateFromHeader() -
setAllowTemplateFromHeader
public void setAllowTemplateFromHeader(boolean allowTemplateFromHeader) Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential security vulnerability if the header is coming from a malicious user, so use this with care. -
getTemplateEngine
protected org.thymeleaf.TemplateEngine getTemplateEngine() -
setTemplateEngine
public void setTemplateEngine(org.thymeleaf.TemplateEngine templateEngine) To use theTemplateEngineotherwise a new engine is created -
setJakartaServletWebApplication
public void setJakartaServletWebApplication(org.thymeleaf.web.servlet.JakartaServletWebApplication jakartaServletWebApplication) -
setTemplate
-
clearContentCache
public void clearContentCache()- Specified by:
clearContentCachein interfaceorg.apache.camel.api.management.mbean.ManagedResourceEndpointMBean- Overrides:
clearContentCachein classorg.apache.camel.component.ResourceEndpoint
-
findOrCreateEndpoint
-
onExchange
- Overrides:
onExchangein classorg.apache.camel.support.ProcessorEndpoint- Throws:
Exception
-