Class UndertowEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.undertow.UndertowEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AsyncEndpoint,org.apache.camel.CamelContextAware,org.apache.camel.cloud.DiscoverableService,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.spi.HeaderFilterStrategyAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.16.0",
scheme="undertow",
title="Undertow",
syntax="undertow:httpURI",
category={HTTP,NETWORKING},
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.
-
Field Summary
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 -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.PollingConsumerorg.apache.camel.Producerprotected voiddoInit()io.undertow.server.handlers.accesslog.AccessLogReceiverorg.apache.camel.http.base.cookie.CookieHandlerorg.apache.camel.spi.HeaderFilterStrategyorg.apache.camel.support.jsse.SSLContextParametersbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetAccessLog(Boolean accessLog) Whether or not the consumer should write access logvoidsetAccessLogReceiver(io.undertow.server.handlers.accesslog.AccessLogReceiver accessLogReceiver) Which Undertow AccessLogReceiver should be used Will use JBossLoggingAccessLogReceiver if not specifiedvoidsetAllowedRoles(String allowedRoles) voidsetCookieHandler(org.apache.camel.http.base.cookie.CookieHandler cookieHandler) Configure a cookie handler to maintain a HTTP sessionvoidsetFireWebSocketChannelEvents(boolean fireWebSocketChannelEvents) iftrue, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc.voidsetHandlers(String handlers) Specifies a comma-delimited set of io.undertow.server.HttpHandler instances in your Registry (such as your Spring ApplicationContext).voidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.voidsetHttpMethodRestrict(String httpMethodRestrict) Used to only allow consuming if the HttpMethod matches, such as GET/POST/PUT etc.voidsetHttpURI(URI httpURI) The url of the HTTP endpoint to use.voidsetKeepAlive(Boolean keepAlive) Setting to ensure socket is not closed due to inactivityvoidsetMatchOnUriPrefix(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.voidsetMuteException(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.voidsetOptions(Map<String, Object> options) Sets additional channel options.voidsetOptionsEnabled(boolean optionsEnabled) Specifies whether to enable HTTP OPTIONS for this Servlet consumer.voidsetPreserveHostHeader(boolean preserveHostHeader) voidsetReuseAddresses(Boolean reuseAddresses) Setting to facilitate socket multiplexingvoidsetSecurityConfiguration(Object securityConfiguration) voidsetSecurityProvider(UndertowSecurityProvider securityProvider) voidsetSendTimeout(Integer sendTimeout) Timeout in milliseconds when sending to a websocket channel.voidsetSendToAll(Boolean sendToAll) To send to all websocket subscribers.voidsetSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) To configure security using SSLContextParametersvoidsetTcpNoDelay(Boolean tcpNoDelay) Setting to improve TCP protocol performancevoidsetThrowExceptionOnFailure(Boolean throwExceptionOnFailure) Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server.voidsetTransferException(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.voidsetUndertowHttpBinding(UndertowHttpBinding undertowHttpBinding) To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow.voidsetUseStreaming(boolean useStreaming) For HTTP endpoint: iftrue, text and binary messages will be wrapped asInputStreambefore they are passed to anExchange; otherwise they will be passed as byte[].Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, 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, 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
getComponent, setComponentMethods inherited from interface org.apache.camel.Endpoint
configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isSingletonProducer, setCamelContextMethods inherited from interface org.apache.camel.IsSingleton
isSingletonMethods 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
-
UndertowEndpoint
-
-
Method Details
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
getSecurityProvider
-
setSecurityProvider
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createPollingConsumer
- Specified by:
createPollingConsumerin interfaceorg.apache.camel.Endpoint- Overrides:
createPollingConsumerin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
isLenientProperties
public boolean isLenientProperties()- Specified by:
isLenientPropertiesin interfaceorg.apache.camel.Endpoint- Overrides:
isLenientPropertiesin classorg.apache.camel.support.DefaultEndpoint
-
getServiceProperties
- Specified by:
getServicePropertiesin interfaceorg.apache.camel.cloud.DiscoverableService
-
getSslContext
-
getHttpURI
-
setHttpURI
The url of the HTTP endpoint to use. -
getHttpMethodRestrict
-
setHttpMethodRestrict
Used to only allow consuming if the HttpMethod matches, such as GET/POST/PUT etc. Multiple methods can be specified separated by comma. -
getMatchOnUriPrefix
-
isMatchOnUriPrefix
public boolean isMatchOnUriPrefix() -
setMatchOnUriPrefix
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:
getHeaderFilterStrategyin interfaceorg.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:
setHeaderFilterStrategyin interfaceorg.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
-
setThrowExceptionOnFailure
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
-
setTransferException
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
-
setMuteException
If enabled and an Exchange failed processing on the consumer side the response's body won't contain the exception's stack trace. -
getUndertowHttpBinding
-
setUndertowHttpBinding
To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow. -
getKeepAlive
-
setKeepAlive
Setting to ensure socket is not closed due to inactivity -
getTcpNoDelay
-
setTcpNoDelay
Setting to improve TCP protocol performance -
getReuseAddresses
-
setReuseAddresses
Setting to facilitate socket multiplexing -
getOptions
-
setOptions
Sets additional channel options. The options that can be used are defined inOptions. To configure from endpoint uri, then prefix each option with option., such as option.close-abort=trueinvalid input: '&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
-
setSendToAll
To send to all websocket subscribers. Can be used to configure on endpoint level, instead of having to use theUndertowConstants.SEND_TO_ALLheader on the message. -
getSendTimeout
-
setSendTimeout
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 asInputStreambefore they are passed to anExchange; otherwise they will be passed as byte[].For WebSocket endpoint: if
true, text and binary messages will be wrapped asReaderandInputStreamrespectively before they are passed to anExchange; otherwise they will be passed as String and byte[] respectively. -
isFireWebSocketChannelEvents
public boolean isFireWebSocketChannelEvents() -
setFireWebSocketChannelEvents
public void setFireWebSocketChannelEvents(boolean fireWebSocketChannelEvents) iftrue, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc. SeeUndertowConstants.EVENT_TYPEandUndertowConstants.EventType. -
setPreserveHostHeader
public void setPreserveHostHeader(boolean preserveHostHeader) -
isPreserveHostHeader
public boolean isPreserveHostHeader() -
getSecurityConfiguration
-
setSecurityConfiguration
-
getAllowedRoles
-
setAllowedRoles
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
isWebSocket
public boolean isWebSocket()- Returns:
trueifgetHttpURI()'s scheme iswsorwss
-
getHttpHandlerRegistrationInfo
-
getWebSocketHttpHandler
-
getAccessLog
-
setAccessLog
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
-
setHandlers
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.
-