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.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.
-
-
Constructor Summary
Constructors Constructor Description UndertowEndpoint(String uri, UndertowComponent component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.camel.PollingConsumer
createPollingConsumer()
org.apache.camel.Producer
createProducer()
protected void
doInit()
Boolean
getAccessLog()
io.undertow.server.handlers.accesslog.AccessLogReceiver
getAccessLogReceiver()
String
getAllowedRoles()
UndertowComponent
getComponent()
org.apache.camel.http.base.cookie.CookieHandler
getCookieHandler()
String
getHandlers()
org.apache.camel.spi.HeaderFilterStrategy
getHeaderFilterStrategy()
HttpHandlerRegistrationInfo
getHttpHandlerRegistrationInfo()
String
getHttpMethodRestrict()
URI
getHttpURI()
Boolean
getKeepAlive()
Boolean
getMatchOnUriPrefix()
Boolean
getMuteException()
Map<String,Object>
getOptions()
Boolean
getReuseAddresses()
Object
getSecurityConfiguration()
UndertowSecurityProvider
getSecurityProvider()
Integer
getSendTimeout()
Boolean
getSendToAll()
Map<String,String>
getServiceProperties()
SSLContext
getSslContext()
org.apache.camel.support.jsse.SSLContextParameters
getSslContextParameters()
Boolean
getTcpNoDelay()
Boolean
getThrowExceptionOnFailure()
Boolean
getTransferException()
UndertowHttpBinding
getUndertowHttpBinding()
CamelWebSocketHandler
getWebSocketHttpHandler()
boolean
isFireWebSocketChannelEvents()
boolean
isLenientProperties()
boolean
isMatchOnUriPrefix()
boolean
isOptionsEnabled()
boolean
isPreserveHostHeader()
boolean
isUseStreaming()
boolean
isWebSocket()
void
setAccessLog(Boolean accessLog)
Whether or not the consumer should write access logvoid
setAccessLogReceiver(io.undertow.server.handlers.accesslog.AccessLogReceiver accessLogReceiver)
Which Undertow AccessLogReceiver should be used Will use JBossLoggingAccessLogReceiver if not specifiedvoid
setAllowedRoles(String allowedRoles)
void
setCookieHandler(org.apache.camel.http.base.cookie.CookieHandler cookieHandler)
Configure a cookie handler to maintain a HTTP sessionvoid
setFireWebSocketChannelEvents(boolean fireWebSocketChannelEvents)
iftrue
, the consumer will post notifications to the route when a new WebSocket peer connects, disconnects, etc.void
setHandlers(String handlers)
Specifies a comma-delimited set of io.undertow.server.HttpHandler instances in your Registry (such as your Spring ApplicationContext).void
setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
To use a custom HeaderFilterStrategy to filter header to and from Camel message.void
setHttpMethodRestrict(String httpMethodRestrict)
Used to only allow consuming if the HttpMethod matches, such as GET/POST/PUT etc.void
setHttpURI(URI httpURI)
The url of the HTTP endpoint to use.void
setKeepAlive(Boolean keepAlive)
Setting to ensure socket is not closed due to inactivityvoid
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.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.void
setOptions(Map<String,Object> options)
Sets additional channel options.void
setOptionsEnabled(boolean optionsEnabled)
Specifies whether to enable HTTP OPTIONS for this Servlet consumer.void
setPreserveHostHeader(boolean preserveHostHeader)
void
setReuseAddresses(Boolean reuseAddresses)
Setting to facilitate socket multiplexingvoid
setSecurityConfiguration(Object securityConfiguration)
void
setSecurityProvider(UndertowSecurityProvider securityProvider)
void
setSendTimeout(Integer sendTimeout)
Timeout in milliseconds when sending to a websocket channel.void
setSendToAll(Boolean sendToAll)
To send to all websocket subscribers.void
setSslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
To configure security using SSLContextParametersvoid
setTcpNoDelay(Boolean tcpNoDelay)
Setting to improve TCP protocol performancevoid
setThrowExceptionOnFailure(Boolean throwExceptionOnFailure)
Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server.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.void
setUndertowHttpBinding(UndertowHttpBinding undertowHttpBinding)
To use a custom UndertowHttpBinding to control the mapping between Camel message and undertow.void
setUseStreaming(boolean useStreaming)
For HTTP endpoint: iftrue
, text and binary messages will be wrapped asInputStream
before 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, doStart, doStop, 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, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, 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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.Endpoint
configureExchange, configureProperties, createAsyncProducer, createExchange, createExchange, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isSingletonProducer, setCamelContext
-
-
-
-
Constructor Detail
-
UndertowEndpoint
public UndertowEndpoint(String uri, UndertowComponent component)
-
-
Method Detail
-
getComponent
public UndertowComponent getComponent()
- Overrides:
getComponent
in classorg.apache.camel.support.DefaultEndpoint
-
getSecurityProvider
public UndertowSecurityProvider getSecurityProvider()
-
setSecurityProvider
public void setSecurityProvider(UndertowSecurityProvider securityProvider)
-
createProducer
public org.apache.camel.Producer createProducer() throws Exception
- Specified by:
createProducer
in interfaceorg.apache.camel.Endpoint
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
- Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Throws:
Exception
-
createPollingConsumer
public org.apache.camel.PollingConsumer createPollingConsumer() throws Exception
- Specified by:
createPollingConsumer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createPollingConsumer
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
isLenientProperties
public boolean isLenientProperties()
- Specified by:
isLenientProperties
in interfaceorg.apache.camel.Endpoint
- Overrides:
isLenientProperties
in classorg.apache.camel.support.DefaultEndpoint
-
getServiceProperties
public Map<String,String> getServiceProperties()
- Specified by:
getServiceProperties
in interfaceorg.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 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:
setHeaderFilterStrategy
in 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
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.
-
getUndertowHttpBinding
public UndertowHttpBinding getUndertowHttpBinding()
-
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 inOptions
. 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 theUndertowConstants.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 asInputStream
before they are passed to anExchange
; otherwise they will be passed as byte[].For WebSocket endpoint: if
true
, text and binary messages will be wrapped asReader
andInputStream
respectively 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_TYPE
andUndertowConstants.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 classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
isWebSocket
public boolean isWebSocket()
- Returns:
true
ifgetHttpURI()
's scheme isws
orwss
-
getHttpHandlerRegistrationInfo
public HttpHandlerRegistrationInfo getHttpHandlerRegistrationInfo()
-
getWebSocketHttpHandler
public CamelWebSocketHandler getWebSocketHttpHandler()
-
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.
-
-