Package org.apache.camel.http.common
Class HttpCommonEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.http.common.HttpCommonEndpoint
- All Implemented Interfaces:
AutoCloseable
,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
public abstract class HttpCommonEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.cloud.DiscoverableService
-
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
ConstructorsModifierConstructorDescriptionprotected
protected
HttpCommonEndpoint
(String endPointURI, HttpCommonComponent component, URI httpURI) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canConnect
(HttpConsumer consumer) void
connect
(HttpConsumer consumer) void
disconnect
(HttpConsumer consumer) Deprecated.org.apache.camel.http.base.cookie.CookieHandler
org.apache.camel.spi.HeaderFilterStrategy
getPath()
int
getPort()
int
int
boolean
isAsync()
boolean
boolean
boolean
boolean
If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
setAsync
(boolean async) If this option is true, the consumer will work in async modevoid
setAuthDomain
(String authDomain) Authentication domain to use with NTMLvoid
setAuthHost
(String authHost) Authentication host to use with NTMLvoid
setAuthMethod
(String authMethod) Authentication methods allowed to use as a comma separated list of values Basic, Digest or NTLM.void
setAuthMethodPriority
(String authMethodPriority) Which authentication method to prioritize to use, either as Basic, Digest or NTLM.void
setAuthPassword
(String authPassword) Authentication passwordvoid
setAuthUsername
(String authUsername) Authentication usernamevoid
setBridgeEndpoint
(boolean bridge) If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request.void
setChunked
(boolean chunked) If this option is false Servlet will disable the HTTP streaming and set the content-length header on the responsevoid
setConnectionClose
(boolean connectionClose) If this option is true, the producer will add a Connection Close header to HTTP Requestvoid
setCookieHandler
(org.apache.camel.http.base.cookie.CookieHandler cookieHandler) Configure a cookie handler to maintain a HTTP sessionvoid
setCopyHeaders
(boolean copyHeaders) void
setDisableStreamCache
(boolean disable) Determines whether or not the raw input stream from Servlet is cached or not (Camel will read the stream into a in memory/overflow to file, Stream caching) cache.void
setEagerCheckContentAvailable
(boolean eagerCheckContentAvailable) Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present.void
setHeaderFilterStrategy
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.void
setHttpBinding
(HttpBinding httpBinding) To use a custom HttpBinding to control the mapping between Camel message and HttpClient.void
setHttpMethod
(HttpMethods httpMethod) Configure the HTTP method to use.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 call.void
setIgnoreResponseBody
(boolean ignoreResponseBody) If this option is true, The http producer won't read response body and cache the input stream.void
setMapHttpMessageBody
(boolean mapHttpMessageBody) If this option is true, the IN exchange body will be mapped to HTTPvoid
setMapHttpMessageFormUrlEncodedBody
(boolean mapHttpMessageFormUrlEncodedBody) If this option is true then IN exchange Form Encoded body will be mapped to HTTPvoid
setMapHttpMessageHeaders
(boolean mapHttpMessageHeaders) If this option is true, the IN exchange headers will be mapped to HTTP Headersvoid
setMatchOnUriPrefix
(boolean match) 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
setOkStatusCodeRange
(String okStatusCodeRange) The status codes which are considered a success response.void
setOptionsEnabled
(boolean optionsEnabled) Specifies whether to enable HTTP OPTIONS for this Servlet consumer.void
setPreserveHostHeader
(boolean preserveHostHeader) If the option is true, HttpProducer will set the Host header to the value contained in the current exchange Host header, useful in reverse proxy applications where you want the Host header received by the downstream server to reflect the URL called by the upstream client, this allows applications which use the Host header to generate accurate URL's for a proxied servicevoid
setProxyAuthDomain
(String proxyAuthDomain) Proxy authentication domain to use with NTMLvoid
setProxyAuthHost
(String proxyAuthHost) Proxy authentication host to use with NTMLvoid
setProxyAuthMethod
(String proxyAuthMethod) Proxy authentication method to usevoid
setProxyAuthNtHost
(String proxyAuthNtHost) Proxy authentication domain (workstation name) to use with NTMLvoid
setProxyAuthPassword
(String proxyAuthPassword) Proxy authentication passwordvoid
setProxyAuthPort
(int proxyAuthPort) Proxy authentication portvoid
setProxyAuthScheme
(String proxyAuthScheme) Proxy authentication scheme to usevoid
setProxyAuthUsername
(String proxyAuthUsername) Proxy authentication usernamevoid
setProxyHost
(String proxyHost) Proxy hostname to usevoid
setProxyPort
(int proxyPort) Proxy port to usevoid
setResponseBufferSize
(Integer responseBufferSize) To use a custom buffer size on the jakarta.servlet.ServletResponse.void
setThrowExceptionOnFailure
(boolean throwExceptionOnFailure) Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server.void
setTraceEnabled
(boolean traceEnabled) Specifies whether to enable HTTP TRACE for this Servlet consumer.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.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, 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, doStart, doStop, 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.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
createConsumer, createProducer, getEndpointBaseUri, isSingletonProducer
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 Details
-
HttpCommonEndpoint
protected HttpCommonEndpoint() -
HttpCommonEndpoint
-
-
Method Details
-
connect
- Throws:
Exception
-
disconnect
- Throws:
Exception
-
canConnect
- Throws:
Exception
-
getComponent
- Specified by:
getComponent
in interfaceorg.apache.camel.ComponentAware
- Overrides:
getComponent
in classorg.apache.camel.support.DefaultEndpoint
-
isLenientProperties
public boolean isLenientProperties()- Specified by:
isLenientProperties
in interfaceorg.apache.camel.Endpoint
- Overrides:
isLenientProperties
in classorg.apache.camel.support.DefaultEndpoint
-
getServiceProperties
- Specified by:
getServiceProperties
in interfaceorg.apache.camel.cloud.DiscoverableService
-
getBinding
Deprecated.usegetHttpBinding()
-
getHttpBinding
-
setHttpBinding
To use a custom HttpBinding to control the mapping between Camel message and HttpClient. -
getPath
-
getPort
public int getPort() -
getProtocol
-
getHttpUri
-
setHttpUri
The url of the HTTP endpoint to call. -
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
-
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. -
isBridgeEndpoint
public boolean isBridgeEndpoint() -
setBridgeEndpoint
public void setBridgeEndpoint(boolean bridge) If the option is true, HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back. -
isPreserveHostHeader
public boolean isPreserveHostHeader() -
setPreserveHostHeader
public void setPreserveHostHeader(boolean preserveHostHeader) If the option is true, HttpProducer will set the Host header to the value contained in the current exchange Host header, useful in reverse proxy applications where you want the Host header received by the downstream server to reflect the URL called by the upstream client, this allows applications which use the Host header to generate accurate URL's for a proxied service -
isMatchOnUriPrefix
public boolean isMatchOnUriPrefix() -
setMatchOnUriPrefix
public void setMatchOnUriPrefix(boolean match) Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found. See more details at: http://camel.apache.org/how-do-i-let-jetty-match-wildcards.html -
isDisableStreamCache
public boolean isDisableStreamCache() -
setDisableStreamCache
public void setDisableStreamCache(boolean disable) Determines whether or not the raw input stream from Servlet is cached or not (Camel will read the stream into a in memory/overflow to file, Stream caching) cache. By default Camel will cache the Servlet 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. DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support reading the stream multiple times. If you use Servlet to bridge/proxy an endpoint then consider enabling this option to improve performance, in case you do not need to read the message payload multiple times. + The http producer will by default cache the response body stream. If setting this option to true, + then the producers will not cache the response body stream but use the response stream as-is as the message body. -
isChunked
public boolean isChunked() -
setChunked
public void setChunked(boolean chunked) If this option is false Servlet will disable the HTTP streaming and set the content-length header on the response -
isTransferException
public boolean isTransferException() -
isMuteException
public boolean isMuteException() -
isConnectionClose
public boolean isConnectionClose() -
setConnectionClose
public void setConnectionClose(boolean connectionClose) If this option is true, the producer will add a Connection Close header to HTTP Request -
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. -
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. -
isTraceEnabled
public boolean isTraceEnabled() -
setTraceEnabled
public void setTraceEnabled(boolean traceEnabled) Specifies whether to enable HTTP TRACE for this Servlet consumer. By default TRACE is turned off. -
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. -
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. -
getResponseBufferSize
-
setResponseBufferSize
To use a custom buffer size on the jakarta.servlet.ServletResponse. -
isIgnoreResponseBody
public boolean isIgnoreResponseBody() -
setIgnoreResponseBody
public void setIgnoreResponseBody(boolean ignoreResponseBody) If this option is true, The http producer won't read response body and cache the input stream. -
isCopyHeaders
public boolean isCopyHeaders()If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false, allows to only include the headers from the HTTP response (not propagating IN headers). -
setCopyHeaders
public void setCopyHeaders(boolean copyHeaders) -
isEagerCheckContentAvailable
public boolean isEagerCheckContentAvailable() -
setEagerCheckContentAvailable
public void setEagerCheckContentAvailable(boolean eagerCheckContentAvailable) Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present. This can be turned on in case HTTP clients do not send streamed data. -
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 -
isMapHttpMessageBody
public boolean isMapHttpMessageBody() -
setMapHttpMessageBody
public void setMapHttpMessageBody(boolean mapHttpMessageBody) If this option is true, the IN exchange body will be mapped to HTTP -
isMapHttpMessageHeaders
public boolean isMapHttpMessageHeaders() -
setMapHttpMessageHeaders
public void setMapHttpMessageHeaders(boolean mapHttpMessageHeaders) If this option is true, the IN exchange headers will be mapped to HTTP Headers -
isMapHttpMessageFormUrlEncodedBody
public boolean isMapHttpMessageFormUrlEncodedBody() -
setMapHttpMessageFormUrlEncodedBody
public void setMapHttpMessageFormUrlEncodedBody(boolean mapHttpMessageFormUrlEncodedBody) If this option is true then IN exchange Form Encoded body will be mapped to HTTP -
isAsync
public boolean isAsync() -
setAsync
public void setAsync(boolean async) If this option is true, the consumer will work in async mode -
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 -
getHttpMethod
-
setHttpMethod
Configure the HTTP method to use. The HttpMethod header cannot override this option if set. -
getAuthMethod
-
setAuthMethod
Authentication methods allowed to use as a comma separated list of values Basic, Digest or NTLM. -
getAuthMethodPriority
-
setAuthMethodPriority
Which authentication method to prioritize to use, either as Basic, Digest or NTLM. -
getAuthUsername
-
setAuthUsername
Authentication username -
getAuthPassword
-
setAuthPassword
Authentication password -
getAuthDomain
-
setAuthDomain
Authentication domain to use with NTML -
getAuthHost
-
setAuthHost
Authentication host to use with NTML -
getProxyAuthScheme
-
setProxyAuthScheme
Proxy authentication scheme to use -
getProxyAuthMethod
-
setProxyAuthMethod
Proxy authentication method to use -
getProxyAuthUsername
-
setProxyAuthUsername
Proxy authentication username -
getProxyAuthPassword
-
setProxyAuthPassword
Proxy authentication password -
getProxyAuthDomain
-
setProxyAuthDomain
Proxy authentication domain to use with NTML -
getProxyAuthHost
-
setProxyAuthHost
Proxy authentication host to use with NTML -
getProxyAuthPort
public int getProxyAuthPort() -
setProxyAuthPort
public void setProxyAuthPort(int proxyAuthPort) Proxy authentication port -
getProxyHost
-
setProxyHost
Proxy hostname to use -
getProxyPort
public int getProxyPort() -
setProxyPort
public void setProxyPort(int proxyPort) Proxy port to use -
getProxyAuthNtHost
-
setProxyAuthNtHost
Proxy authentication domain (workstation name) to use with NTML
-
getHttpBinding()