Class UndertowEndpoint

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.AsyncEndpoint, org.apache.camel.CamelContextAware, org.apache.camel.cloud.DiscoverableService, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasId, org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @UriEndpoint(firstVersion="2.16.0",
                 scheme="undertow",
                 title="Undertow",
                 syntax="undertow:httpURI",
                 category={HTTP,WEBSOCKET},
                 lenientProperties=true,
                 headersClass=UndertowConstants.class)
    public class UndertowEndpoint
    extends org.apache.camel.support.DefaultEndpoint
    implements org.apache.camel.AsyncEndpoint, org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.cloud.DiscoverableService
    Expose HTTP and WebSocket endpoints and access external HTTP/WebSocket servers.
    • Method Detail

      • getComponent

        public UndertowComponent getComponent()
        Overrides:
        getComponent in class org.apache.camel.support.DefaultEndpoint
      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Specified by:
        createProducer in interface org.apache.camel.Endpoint
        Throws:
        Exception
      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)
                                                 throws Exception
        Specified by:
        createConsumer in interface org.apache.camel.Endpoint
        Throws:
        Exception
      • createPollingConsumer

        public org.apache.camel.PollingConsumer createPollingConsumer()
                                                               throws Exception
        Specified by:
        createPollingConsumer in interface org.apache.camel.Endpoint
        Overrides:
        createPollingConsumer in class org.apache.camel.support.DefaultEndpoint
        Throws:
        Exception
      • isLenientProperties

        public boolean isLenientProperties()
        Specified by:
        isLenientProperties in interface org.apache.camel.Endpoint
        Overrides:
        isLenientProperties in class org.apache.camel.support.DefaultEndpoint
      • getServiceProperties

        public Map<String,​String> getServiceProperties()
        Specified by:
        getServiceProperties in interface org.apache.camel.cloud.DiscoverableService
      • getSslContext

        public SSLContext getSslContext()
      • getHttpURI

        public URI getHttpURI()
      • setHttpURI

        public void setHttpURI​(URI httpURI)
        The url of the HTTP endpoint to use.
      • getHttpMethodRestrict

        public String getHttpMethodRestrict()
      • setHttpMethodRestrict

        public void setHttpMethodRestrict​(String httpMethodRestrict)
        Used to only allow consuming if the HttpMethod matches, such as GET/POST/PUT etc. Multiple methods can be specified separated by comma.
      • getMatchOnUriPrefix

        public Boolean getMatchOnUriPrefix()
      • isMatchOnUriPrefix

        public boolean isMatchOnUriPrefix()
      • setMatchOnUriPrefix

        public void setMatchOnUriPrefix​(Boolean matchOnUriPrefix)
        Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found.
      • getHeaderFilterStrategy

        public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
        Specified by:
        getHeaderFilterStrategy in interface org.apache.camel.spi.HeaderFilterStrategyAware
      • setHeaderFilterStrategy

        public void setHeaderFilterStrategy​(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
        To use a custom HeaderFilterStrategy to filter header to and from Camel message.
        Specified by:
        setHeaderFilterStrategy in interface org.apache.camel.spi.HeaderFilterStrategyAware
      • getSslContextParameters

        public org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()
      • setSslContextParameters

        public void setSslContextParameters​(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
        To configure security using SSLContextParameters
      • getThrowExceptionOnFailure

        public Boolean getThrowExceptionOnFailure()
      • setThrowExceptionOnFailure

        public void setThrowExceptionOnFailure​(Boolean throwExceptionOnFailure)
        Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.
      • getTransferException

        public Boolean getTransferException()
      • setTransferException

        public void setTransferException​(Boolean transferException)
        If enabled and an Exchange failed processing on the consumer side and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type. On the producer side the exception will be deserialized and thrown as is instead of the HttpOperationFailedException. The caused exception is required to be serialized. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
      • getMuteException

        public Boolean getMuteException()
      • setMuteException

        public void setMuteException​(Boolean muteException)
        If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace.
      • setUndertowHttpBinding

        public void setUndertowHttpBinding​(UndertowHttpBinding undertowHttpBinding)
        To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow.
      • getKeepAlive

        public Boolean getKeepAlive()
      • setKeepAlive

        public void setKeepAlive​(Boolean keepAlive)
        Setting to ensure socket is not closed due to inactivity
      • getTcpNoDelay

        public Boolean getTcpNoDelay()
      • setTcpNoDelay

        public void setTcpNoDelay​(Boolean tcpNoDelay)
        Setting to improve TCP protocol performance
      • getReuseAddresses

        public Boolean getReuseAddresses()
      • setReuseAddresses

        public void setReuseAddresses​(Boolean reuseAddresses)
        Setting to facilitate socket multiplexing
      • setOptions

        public void setOptions​(Map<String,​Object> options)
        Sets additional channel options. The options that can be used are defined in Options. To configure from endpoint uri, then prefix each option with option., such as option.close-abort=true&option.send-buffer=8192
      • isOptionsEnabled

        public boolean isOptionsEnabled()
      • setOptionsEnabled

        public void setOptionsEnabled​(boolean optionsEnabled)
        Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default OPTIONS is turned off.
      • getCookieHandler

        public org.apache.camel.http.base.cookie.CookieHandler getCookieHandler()
      • setCookieHandler

        public void setCookieHandler​(org.apache.camel.http.base.cookie.CookieHandler cookieHandler)
        Configure a cookie handler to maintain a HTTP session
      • getSendToAll

        public Boolean getSendToAll()
      • setSendToAll

        public void setSendToAll​(Boolean sendToAll)
        To send to all websocket subscribers. Can be used to configure on endpoint level, instead of having to use the UndertowConstants.SEND_TO_ALL header on the message.
      • getSendTimeout

        public Integer getSendTimeout()
      • setSendTimeout

        public void setSendTimeout​(Integer sendTimeout)
        Timeout in milliseconds when sending to a websocket channel. The default timeout is 30000 (30 seconds).
      • isUseStreaming

        public boolean isUseStreaming()
      • setUseStreaming

        public void setUseStreaming​(boolean useStreaming)

        For HTTP endpoint: if true, text and binary messages will be wrapped as InputStream before they are passed to an Exchange; otherwise they will be passed as byte[].

        For WebSocket endpoint: if true, text and binary messages will be wrapped as Reader and InputStream respectively before they are passed to an Exchange; otherwise they will be passed as String and byte[] respectively.

      • isFireWebSocketChannelEvents

        public boolean isFireWebSocketChannelEvents()
      • setFireWebSocketChannelEvents

        public void setFireWebSocketChannelEvents​(boolean fireWebSocketChannelEvents)
        if true, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. See UndertowConstants.EVENT_TYPE and UndertowConstants.EventType.
      • setPreserveHostHeader

        public void setPreserveHostHeader​(boolean preserveHostHeader)
      • isPreserveHostHeader

        public boolean isPreserveHostHeader()
      • getSecurityConfiguration

        public Object getSecurityConfiguration()
      • setSecurityConfiguration

        public void setSecurityConfiguration​(Object securityConfiguration)
      • getAllowedRoles

        public String getAllowedRoles()
      • setAllowedRoles

        public void setAllowedRoles​(String allowedRoles)
      • doInit

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

        public boolean isWebSocket()
        Returns:
        true if getHttpURI()'s scheme is ws or wss
      • getAccessLog

        public Boolean getAccessLog()
      • setAccessLog

        public void setAccessLog​(Boolean accessLog)
        Whether or not the consumer should write access log
      • getAccessLogReceiver

        public io.undertow.server.handlers.accesslog.AccessLogReceiver getAccessLogReceiver()
      • setAccessLogReceiver

        public void setAccessLogReceiver​(io.undertow.server.handlers.accesslog.AccessLogReceiver accessLogReceiver)
        Which Undertow AccessLogReceiver should be used Will use JBossLoggingAccessLogReceiver if not specified
      • getHandlers

        public String getHandlers()
      • setHandlers

        public void setHandlers​(String handlers)
        Specifies a comma-delimited set of io.undertow.server.HttpHandler instances in your Registry (such as your Spring ApplicationContext). These handlers are added to the Undertow handler chain (for example, to add security). Important: You can not use different handlers with different Undertow endpoints using the same port number. The handlers is associated to the port number. If you need different handlers, then use different port numbers.