Class ServletComponent

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Component, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.spi.RestApiConsumerFactory, org.apache.camel.spi.RestConsumerFactory, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Component("servlet")
    public class ServletComponent
    extends org.apache.camel.http.common.HttpCommonComponent
    implements org.apache.camel.spi.RestConsumerFactory, org.apache.camel.spi.RestApiConsumerFactory
    • Field Summary

      • Fields inherited from class org.apache.camel.http.common.HttpCommonComponent

        allowJavaSerializedObject, httpBinding, httpConfiguration, muteException
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connect​(org.apache.camel.http.common.HttpConsumer consumer)  
      org.apache.camel.Consumer createApiConsumer​(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, String contextPath, org.apache.camel.spi.RestConfiguration configuration, Map<String,​Object> parameters)  
      org.apache.camel.Consumer createConsumer​(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, String verb, String basePath, String uriTemplate, String consumes, String produces, org.apache.camel.spi.RestConfiguration configuration, Map<String,​Object> parameters)  
      protected org.apache.camel.Endpoint createEndpoint​(String uri, String remaining, Map<String,​Object> parameters)  
      protected ServletEndpoint createServletEndpoint​(String endpointUri, ServletComponent component, URI httpUri)
      Strategy to create the servlet endpoint.
      void disconnect​(org.apache.camel.http.common.HttpConsumer consumer)  
      protected void doInit()  
      String getFileNameExtWhitelist()  
      org.apache.camel.http.common.HttpRegistry getHttpRegistry()  
      String getServletName()  
      boolean isAttachmentMultipartBinding()  
      protected boolean lenientContextPath()
      Whether defining the context-path is lenient and do not require an exact leading slash.
      void setAttachmentMultipartBinding​(boolean attachmentMultipartBinding)
      Whether to automatic bind multipart/form-data as attachments on the Camel Exchange.
      void setFileNameExtWhitelist​(String fileNameExtWhitelist)
      Whitelist of accepted filename extensions for accepting uploaded files.
      void setHttpRegistry​(org.apache.camel.http.common.HttpRegistry httpRegistry)
      To use a custom org.apache.camel.component.servlet.HttpRegistry.
      void setServletName​(String servletName)
      Default name of servlet to use.
      • Methods inherited from class org.apache.camel.http.common.HttpCommonComponent

        canConnect, getHttpBinding, getHttpConfiguration, getParameter, getParameter, isAllowJavaSerializedObject, isMuteException, setAllowJavaSerializedObject, setHttpBinding, setHttpConfiguration, setMuteException, useIntrospectionOnEndpoint
      • Methods inherited from class org.apache.camel.support.HeaderFilterStrategyComponent

        getHeaderFilterStrategy, setEndpointHeaderFilterStrategy, setHeaderFilterStrategy
      • Methods inherited from class org.apache.camel.support.DefaultComponent

        afterConfiguration, createEndpoint, createEndpoint, doBuild, doStart, doStop, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getComponentPropertyConfigurer, getDefaultName, getEndpointPropertyConfigurer, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, resolveRawParameterValues, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setLazyStartProducer, setProperties, setProperties, setProperties, useRawUri, validateParameters, validateURI
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doFail, doLifecycleChange, doResume, doShutdown, 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 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 Detail

      • ServletComponent

        public ServletComponent()
    • Method Detail

      • createEndpoint

        protected org.apache.camel.Endpoint createEndpoint​(String uri,
                                                           String remaining,
                                                           Map<String,​Object> parameters)
                                                    throws Exception
        Specified by:
        createEndpoint in class org.apache.camel.support.DefaultComponent
        Throws:
        Exception
      • lenientContextPath

        protected boolean lenientContextPath()
        Whether defining the context-path is lenient and do not require an exact leading slash.
      • connect

        public void connect​(org.apache.camel.http.common.HttpConsumer consumer)
                     throws Exception
        Overrides:
        connect in class org.apache.camel.http.common.HttpCommonComponent
        Throws:
        Exception
      • disconnect

        public void disconnect​(org.apache.camel.http.common.HttpConsumer consumer)
                        throws Exception
        Overrides:
        disconnect in class org.apache.camel.http.common.HttpCommonComponent
        Throws:
        Exception
      • getServletName

        public String getServletName()
      • setServletName

        public void setServletName​(String servletName)
        Default name of servlet to use. The default name is CamelServlet.
      • getHttpRegistry

        public org.apache.camel.http.common.HttpRegistry getHttpRegistry()
      • setHttpRegistry

        public void setHttpRegistry​(org.apache.camel.http.common.HttpRegistry httpRegistry)
        To use a custom org.apache.camel.component.servlet.HttpRegistry.
      • isAttachmentMultipartBinding

        public boolean isAttachmentMultipartBinding()
      • setAttachmentMultipartBinding

        public void setAttachmentMultipartBinding​(boolean attachmentMultipartBinding)
        Whether to automatic bind multipart/form-data as attachments on the Camel Exchange.

        The options attachmentMultipartBinding=true and disableStreamCache=false cannot work together. Remove disableStreamCache to use AttachmentMultipartBinding.

        This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.

      • getFileNameExtWhitelist

        public String getFileNameExtWhitelist()
      • setFileNameExtWhitelist

        public void setFileNameExtWhitelist​(String fileNameExtWhitelist)
        Whitelist of accepted filename extensions for accepting uploaded files.

        Multiple extensions can be separated by comma, such as txt,xml.

      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.CamelContext camelContext,
                                                        org.apache.camel.Processor processor,
                                                        String verb,
                                                        String basePath,
                                                        String uriTemplate,
                                                        String consumes,
                                                        String produces,
                                                        org.apache.camel.spi.RestConfiguration configuration,
                                                        Map<String,​Object> parameters)
                                                 throws Exception
        Specified by:
        createConsumer in interface org.apache.camel.spi.RestConsumerFactory
        Throws:
        Exception
      • createApiConsumer

        public org.apache.camel.Consumer createApiConsumer​(org.apache.camel.CamelContext camelContext,
                                                           org.apache.camel.Processor processor,
                                                           String contextPath,
                                                           org.apache.camel.spi.RestConfiguration configuration,
                                                           Map<String,​Object> parameters)
                                                    throws Exception
        Specified by:
        createApiConsumer in interface org.apache.camel.spi.RestApiConsumerFactory
        Throws:
        Exception
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.DefaultComponent
        Throws:
        Exception