Class VelocityEndpoint

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.support.DefaultPollingEndpoint
org.apache.camel.support.ProcessorEndpoint
org.apache.camel.component.ResourceEndpoint
org.apache.camel.component.velocity.VelocityEndpoint
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

@UriEndpoint(firstVersion="1.2.0", scheme="velocity", title="Velocity", syntax="velocity:resourceUri", remote=false, producerOnly=true, category=TRANSFORMATION, headersClass=VelocityConstants.class) public class VelocityEndpoint extends org.apache.camel.component.ResourceEndpoint
Transform messages using a Velocity template.
  • Field Summary

    Fields inherited from class org.apache.camel.component.ResourceEndpoint

    log

    Fields inherited from class org.apache.camel.support.service.BaseService

    BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    VelocityEndpoint(String uri, VelocityComponent component, String resourceUri)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     
    findOrCreateEndpoint(String uri, String newResourceUri)
     
     
    org.apache.camel.ExchangePattern
     
     
    boolean
     
    boolean
     
    protected void
    onExchange(org.apache.camel.Exchange exchange)
     
    void
    setAllowTemplateFromHeader(boolean allowTemplateFromHeader)
    Whether to allow to use resource template from header or not (default false).
    void
    setEncoding(String encoding)
    Character encoding of the resource content.
    void
    setLoaderCache(boolean loaderCache)
    Enables / disables the velocity resource loader cache which is enabled by default
    void
    The URI of the properties file which is used for VelocityEngine initialization.
    void
    setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)
     

    Methods inherited from class org.apache.camel.component.ResourceEndpoint

    clearContentCache, getCamelId, getCamelManagementName, getResourceAsInputStream, getResourceAsInputStreamWithoutCache, getResourceUri, getState, isAllowContextMapAll, isContentCache, isContentCacheCleared, loadResource, setAllowContextMapAll, setContentCache, setResourceUri

    Methods inherited from class org.apache.camel.support.ProcessorEndpoint

    createPollingConsumer, createProcessor, createProducer, getProcessor, setProcessor

    Methods inherited from class org.apache.camel.support.DefaultPollingEndpoint

    createConsumer

    Methods 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, setUseFixedDelay

    Methods 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, toString

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.camel.ComponentAware

    getComponent

    Methods inherited from interface org.apache.camel.Endpoint

    getEndpointBaseUri, isSingletonProducer

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Constructor Details

    • VelocityEndpoint

      public VelocityEndpoint()
    • VelocityEndpoint

      public VelocityEndpoint(String uri, VelocityComponent component, String resourceUri)
  • Method Details

    • getExchangePattern

      public org.apache.camel.ExchangePattern getExchangePattern()
      Specified by:
      getExchangePattern in interface org.apache.camel.Endpoint
      Overrides:
      getExchangePattern in class org.apache.camel.support.DefaultEndpoint
    • createEndpointUri

      protected String createEndpointUri()
      Overrides:
      createEndpointUri in class org.apache.camel.support.DefaultEndpoint
    • setVelocityEngine

      public void setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)
    • 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.
    • isLoaderCache

      public boolean isLoaderCache()
    • setLoaderCache

      public void setLoaderCache(boolean loaderCache)
      Enables / disables the velocity resource loader cache which is enabled by default
    • setEncoding

      public void setEncoding(String encoding)
      Character encoding of the resource content.
    • getEncoding

      public String getEncoding()
    • setPropertiesFile

      public void setPropertiesFile(String file)
      The URI of the properties file which is used for VelocityEngine initialization.
    • getPropertiesFile

      public String getPropertiesFile()
    • findOrCreateEndpoint

      public VelocityEndpoint findOrCreateEndpoint(String uri, String newResourceUri)
    • onExchange

      protected void onExchange(org.apache.camel.Exchange exchange) throws Exception
      Overrides:
      onExchange in class org.apache.camel.support.ProcessorEndpoint
      Throws:
      Exception