Class NettyHttpConfiguration
java.lang.Object
org.apache.camel.component.netty.NettyServerBootstrapConfiguration
org.apache.camel.component.netty.NettyConfiguration
org.apache.camel.component.netty.http.NettyHttpConfiguration
- All Implemented Interfaces:
Cloneable
@UriParams
@Configurer
public class NettyHttpConfiguration
extends org.apache.camel.component.netty.NettyConfiguration
Extended configuration for using HTTP with Netty.
-
Field Summary
Fields inherited from class org.apache.camel.component.netty.NettyServerBootstrapConfiguration
backlog, bossCount, bossGroup, broadcast, channelGroup, connectTimeout, DEFAULT_ENABLED_PROTOCOLS, enabledProtocols, keepAlive, keyStoreFormat, keyStoreResource, nativeTransport, needClientAuth, nettyServerBootstrapFactory, networkInterface, options, passphrase, port, receiveBufferSize, receiveBufferSizePredictor, reuseAddress, securityProvider, sendBufferSize, serverInitializerFactory, ssl, sslClientCertHeaders, sslContextParameters, sslHandler, tcpNoDelay, trustStoreResource, workerCount, workerGroup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()intgetHost()intintintgetPath()intgetPort()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetBridgeEndpoint(boolean bridgeEndpoint) If the option is true, the producer will ignore the NettyHttpConstants.HTTP_URI header, and use the endpoint's URI for request.voidsetChunkedMaxContentLength(int chunkedMaxContentLength) Value in bytes the max content length per chunked frame received on the Netty HTTP server.voidsetCompression(boolean compression) Allow using gzip/deflate for compression on the Netty HTTP server if the client supports it from the HTTP headers.voidsetDisableStreamCache(boolean disableStreamCache) Determines whether or not the raw input stream from Netty HttpRequest#getContent() or HttpResponset#getContent() is cached or not (Camel will read the stream into a in light-weight memory based Stream caching) cache.voidThe local hostname such as localhost, or 0.0.0.0 when being a consumer.voidsetLogWarnOnBadRequest(boolean logWarnOnBadRequest) Whether Netty HTTP server should log a WARN if decoding the HTTP request failed and a HTTP Status 400 (bad request) is returned.voidsetMapHeaders(boolean mapHeaders) If this option is enabled, then during binding from Netty to Camel Message then the headers will be mapped as well (eg added as header to the Camel Message as well).voidsetMatchOnUriPrefix(boolean matchOnUriPrefix) Whether or not Camel should try to find a target consumer by matching the URI prefix if no exact match is found.voidsetMaxChunkSize(int maxChunkSize) The maximum length of the content or each chunk.voidsetMaxHeaderSize(int maxHeaderSize) The maximum length of all headers.voidsetMaxInitialLineLength(int maxInitialLineLength) The maximum length of the initial line (e.g.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.voidsetOkStatusCodeRange(String okStatusCodeRange) The status codes which are considered a success response.voidResource pathvoidsetPort(int port) The port number.voidsetProtocol(String protocol) The protocol to use which is either http, https or proxy (consumer only).voidsetSend503whenSuspended(boolean send503whenSuspended) Whether to send back HTTP status code 503 when the consumer has been suspended.voidsetSynchronous(boolean synchronous) voidsetThrowExceptionOnFailure(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.voidsetUrlDecodeHeaders(boolean urlDecodeHeaders) If this option is enabled, then during binding from Netty to Camel Message then the header values will be URL decoded (eg %20 will be a space character.voidsetUseRelativePath(boolean useRelativePath) Sets whether to use a relative path in HTTP requests.Methods inherited from class org.apache.camel.component.netty.NettyConfiguration
addDecoder, addEncoder, getCharsetName, getClientInitializerFactory, getCorrelationManager, getDecoderMaxLineLength, getDecoders, getDecodersAsList, getDelimiter, getEncoders, getEncodersAsList, getEncoding, getNoReplyLogLevel, getProducerPoolMaxIdle, getProducerPoolMaxTotal, getProducerPoolMaxWait, getProducerPoolMinEvictableIdle, getProducerPoolMinIdle, getRequestTimeout, getServerClosedChannelExceptionCaughtLogLevel, getServerExceptionCaughtLogLevel, isAllowDefaultCodec, isAllowSerializedHeaders, isAutoAppendDelimiter, isClientMode, isDisconnect, isDisconnectOnNoReply, isHostnameVerification, isLazyChannelCreation, isProducerPoolBlockWhenExhausted, isProducerPoolEnabled, isReuseChannel, isSync, isTextline, isTransferExchange, isUdpByteArrayCodec, isUdpConnectionlessSending, isUseByteBuf, isUsingExecutorService, parseURI, setAllowDefaultCodec, setAllowSerializedHeaders, setAutoAppendDelimiter, setClientInitializerFactory, setClientMode, setCorrelationManager, setDecoderMaxLineLength, setDecoders, setDecoders, setDecodersAsList, setDelimiter, setDisconnect, setDisconnectOnNoReply, setEncoders, setEncoders, setEncodersAsList, setEncoding, setHostnameVerification, setLazyChannelCreation, setNoReplyLogLevel, setProducerPoolBlockWhenExhausted, setProducerPoolEnabled, setProducerPoolMaxIdle, setProducerPoolMaxTotal, setProducerPoolMaxWait, setProducerPoolMinEvictableIdle, setProducerPoolMinIdle, setRequestTimeout, setReuseChannel, setServerClosedChannelExceptionCaughtLogLevel, setServerExceptionCaughtLogLevel, setSync, setTextline, setTransferExchange, setUdpByteArrayCodec, setUdpConnectionlessSending, setUseByteBuf, setUsingExecutorService, validateConfigurationMethods inherited from class org.apache.camel.component.netty.NettyServerBootstrapConfiguration
addAdditionalOptions, compatible, getAddress, getBacklog, getBossCount, getBossGroup, getChannelGroup, getConnectTimeout, getEnabledProtocols, getKeyStoreFormat, getKeyStoreResource, getNettyServerBootstrapFactory, getNetworkInterface, getOptions, getOptionValue, getPassphrase, getReceiveBufferSize, getReceiveBufferSizePredictor, getReconnectInterval, getSecurityProvider, getSendBufferSize, getServerInitializerFactory, getShutdownTimeout, getSslContextParameters, getSslHandler, getTrustStoreResource, getUnixDomainSocketPath, getWorkerCount, getWorkerGroup, isBroadcast, isKeepAlive, isNativeTransport, isNeedClientAuth, isReconnect, isReuseAddress, isSsl, isSslClientCertHeaders, isTcp, isTcpNoDelay, setBacklog, setBossCount, setBossGroup, setBroadcast, setChannelGroup, setConnectTimeout, setEnabledProtocols, setKeepAlive, setKeyStoreFormat, setKeyStoreResource, setNativeTransport, setNeedClientAuth, setNettyServerBootstrapFactory, setNetworkInterface, setOptions, setPassphrase, setReceiveBufferSize, setReceiveBufferSizePredictor, setReconnect, setReconnectInterval, setReuseAddress, setSecurityProvider, setSendBufferSize, setServerInitializerFactory, setShutdownTimeout, setSsl, setSslClientCertHeaders, setSslContextParameters, setSslHandler, setTcpNoDelay, setTrustStoreResource, setUnixDomainSocketPath, setWorkerCount, setWorkerGroup, toStringBootstrapConfiguration
-
Constructor Details
-
NettyHttpConfiguration
public NettyHttpConfiguration()
-
-
Method Details
-
copy
- Overrides:
copyin classorg.apache.camel.component.netty.NettyConfiguration
-
getProtocol
- Overrides:
getProtocolin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
setProtocol
The protocol to use which is either http, https or proxy (consumer only).- Overrides:
setProtocolin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
getHost
- Overrides:
getHostin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
setHost
The local hostname such as localhost, or 0.0.0.0 when being a consumer. The remote HTTP server hostname when using producer.- Overrides:
setHostin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
getPort
public int getPort()- Overrides:
getPortin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
setPort
public void setPort(int port) The port number. Is default 80 for http and 443 for https.- Overrides:
setPortin classorg.apache.camel.component.netty.NettyServerBootstrapConfiguration
-
isCompression
public boolean isCompression() -
setCompression
public void setCompression(boolean compression) Allow using gzip/deflate for compression on the Netty HTTP server if the client supports it from the HTTP headers. -
isThrowExceptionOnFailure
public boolean isThrowExceptionOnFailure() -
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. -
isTransferException
public boolean isTransferException() -
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. -
isMuteException
public boolean isMuteException() -
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. -
isUrlDecodeHeaders
public boolean isUrlDecodeHeaders() -
setUrlDecodeHeaders
public void setUrlDecodeHeaders(boolean urlDecodeHeaders) If this option is enabled, then during binding from Netty to Camel Message then the header values will be URL decoded (eg %20 will be a space character. Notice this option is used by the default org.apache.camel.component.netty.http.NettyHttpBinding and therefore if you implement a custom org.apache.camel.component.netty.http.NettyHttpBinding then you would need to decode the headers accordingly to this option. -
isMapHeaders
public boolean isMapHeaders() -
setMapHeaders
public void setMapHeaders(boolean mapHeaders) If this option is enabled, then during binding from Netty to Camel Message then the headers will be mapped as well (eg added as header to the Camel Message as well). You can turn off this option to disable this. The headers can still be accessed from the org.apache.camel.component.netty.http.NettyHttpMessage message with the method getHttpRequest() that returns the Netty HTTP request io.netty.handler.codec.http.HttpRequest instance. -
isMatchOnUriPrefix
public boolean isMatchOnUriPrefix() -
setMatchOnUriPrefix
public void setMatchOnUriPrefix(boolean matchOnUriPrefix) Whether or not Camel should try to find a target consumer by matching the URI prefix if no exact match is found. -
isLogWarnOnBadRequest
public boolean isLogWarnOnBadRequest() -
setLogWarnOnBadRequest
public void setLogWarnOnBadRequest(boolean logWarnOnBadRequest) Whether Netty HTTP server should log a WARN if decoding the HTTP request failed and a HTTP Status 400 (bad request) is returned. -
isBridgeEndpoint
public boolean isBridgeEndpoint() -
setBridgeEndpoint
public void setBridgeEndpoint(boolean bridgeEndpoint) If the option is true, the producer will ignore the NettyHttpConstants.HTTP_URI header, and use the endpoint's URI for request. You may also set the throwExceptionOnFailure to be false to let the producer send all the fault response back. The consumer working in the bridge mode will skip the gzip compression and WWW URL form encoding (by adding the Exchange.SKIP_GZIP_ENCODING and Exchange.SKIP_WWW_FORM_URLENCODED headers to the consumed exchange). -
getPath
-
setPath
Resource path -
isDisableStreamCache
public boolean isDisableStreamCache() -
setDisableStreamCache
public void setDisableStreamCache(boolean disableStreamCache) Determines whether or not the raw input stream from Netty HttpRequest#getContent() or HttpResponset#getContent() is cached or not (Camel will read the stream into a in light-weight memory based Stream caching) cache. By default Camel will cache the Netty input stream to support reading it multiple times to ensure it Camel can retrieve all data from the stream. However you can set this option to true when you for example need to access the raw stream, such as streaming it directly to a file or other persistent store. Mind that if you enable this option, then you cannot read the Netty stream multiple times out of the box, and you would need manually to reset the reader index on the Netty raw stream. Also Netty will auto-close the Netty stream when the Netty HTTP server/HTTP client is done processing, which means that if the asynchronous routing engine is in use then any asynchronous thread that may continue routing theExchangemay not be able to read the Netty stream, because Netty has closed it. -
isSend503whenSuspended
public boolean isSend503whenSuspended() -
setSend503whenSuspended
public void setSend503whenSuspended(boolean send503whenSuspended) Whether to send back HTTP status code 503 when the consumer has been suspended. If the option is false then the Netty Acceptor is unbound when the consumer is suspended, so clients cannot connect anymore. -
getChunkedMaxContentLength
public int getChunkedMaxContentLength() -
setChunkedMaxContentLength
public void setChunkedMaxContentLength(int chunkedMaxContentLength) Value in bytes the max content length per chunked frame received on the Netty HTTP server. -
getMaxHeaderSize
public int getMaxHeaderSize() -
setMaxInitialLineLength
public void setMaxInitialLineLength(int maxInitialLineLength) The maximum length of the initial line (e.g."GET / HTTP/1.0"or"HTTP/1.0 200 OK") If the length of the initial line exceeds this value, awill be raised. Seeinvalid reference
TooLongFrameExceptionHttpObjectDecoder -
getMaxInitialLineLength
public int getMaxInitialLineLength() -
setMaxChunkSize
public void setMaxChunkSize(int maxChunkSize) The maximum length of the content or each chunk. If the content length (or the length of each chunk) exceeds this value, the content or chunk will be split into multipleHttpContents whose length ismaxChunkSizeat maximum. SeeHttpObjectDecoder -
getMaxChunkSize
public int getMaxChunkSize() -
setMaxHeaderSize
public void setMaxHeaderSize(int maxHeaderSize) The maximum length of all headers. If the sum of the length of each header exceeds this value, aTooLongFrameExceptionwill be raised. -
getOkStatusCodeRange
-
setOkStatusCodeRange
The status codes which are considered a success response. The values are inclusive. Multiple ranges can be defined, separated by comma, e.g. 200-204,209,301-304. Each range must be a single number or from-to with the dash included. The default range is 200-299 -
setUseRelativePath
public void setUseRelativePath(boolean useRelativePath) Sets whether to use a relative path in HTTP requests. -
isUseRelativePath
public boolean isUseRelativePath() -
isHttpProxy
public boolean isHttpProxy() -
isSynchronous
public boolean isSynchronous() -
setSynchronous
public void setSynchronous(boolean synchronous)
-