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.EndpointServiceLocation, 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, org.apache.camel.spi.EndpointServiceLocation
  • Constructor Details Link icon

    • HttpCommonEndpoint Link icon

      protected HttpCommonEndpoint()
    • HttpCommonEndpoint Link icon

      protected HttpCommonEndpoint(String endPointURI, HttpCommonComponent component, URI httpURI)
  • Method Details Link icon

    • getServiceUrl Link icon

      public String getServiceUrl()
      Specified by:
      getServiceUrl in interface org.apache.camel.spi.EndpointServiceLocation
    • getServiceProtocol Link icon

      public String getServiceProtocol()
      Specified by:
      getServiceProtocol in interface org.apache.camel.spi.EndpointServiceLocation
    • connect Link icon

      public void connect(HttpConsumer consumer) throws Exception
      Throws:
      Exception
    • disconnect Link icon

      public void disconnect(HttpConsumer consumer) throws Exception
      Throws:
      Exception
    • canConnect Link icon

      public boolean canConnect(HttpConsumer consumer) throws Exception
      Throws:
      Exception
    • getComponent Link icon

      public HttpCommonComponent getComponent()
      Specified by:
      getComponent in interface org.apache.camel.ComponentAware
      Overrides:
      getComponent in class org.apache.camel.support.DefaultEndpoint
    • isLenientProperties Link icon

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

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

      @Deprecated public HttpBinding getBinding()
      Deprecated.
    • getHttpBinding Link icon

      public HttpBinding getHttpBinding()
    • setHttpBinding Link icon

      public void setHttpBinding(HttpBinding httpBinding)
      To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
    • getPath Link icon

      public String getPath()
    • getPort Link icon

      public int getPort()
    • getProtocol Link icon

      public String getProtocol()
    • getHttpUri Link icon

      public URI getHttpUri()
    • setHttpUri Link icon

      public void setHttpUri(URI httpUri)
      The url of the HTTP endpoint to call.
    • getHeaderFilterStrategy Link icon

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

      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
    • isThrowExceptionOnFailure Link icon

      public boolean isThrowExceptionOnFailure()
    • setThrowExceptionOnFailure Link icon

      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 Link icon

      public boolean isBridgeEndpoint()
    • setBridgeEndpoint Link icon

      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 Link icon

      public boolean isPreserveHostHeader()
    • setPreserveHostHeader Link icon

      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 Link icon

      public boolean isMatchOnUriPrefix()
    • setMatchOnUriPrefix Link icon

      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 Link icon

      public boolean isDisableStreamCache()
    • setDisableStreamCache Link icon

      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 Link icon

      public boolean isChunked()
    • setChunked Link icon

      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 Link icon

      public boolean isTransferException()
    • isMuteException Link icon

      public boolean isMuteException()
    • isLogException Link icon

      public boolean isLogException()
    • isConnectionClose Link icon

      public boolean isConnectionClose()
    • setConnectionClose Link icon

      public void setConnectionClose(boolean connectionClose)
      If this option is true, the producer will add a Connection Close header to HTTP Request
    • setTransferException Link icon

      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 Link icon

      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.
    • setLogException Link icon

      public void setLogException(boolean logException)
      If enabled and an Exchange failed processing on the consumer side the exception's stack trace will be logged when the exception stack trace is not sent in the response's body.
    • isTraceEnabled Link icon

      public boolean isTraceEnabled()
    • setTraceEnabled Link icon

      public void setTraceEnabled(boolean traceEnabled)
      Specifies whether to enable HTTP TRACE for this Servlet consumer. By default TRACE is turned off.
    • isOptionsEnabled Link icon

      public boolean isOptionsEnabled()
    • setOptionsEnabled Link icon

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

      public String getHttpMethodRestrict()
    • setHttpMethodRestrict Link icon

      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.
    • getResponseBufferSize Link icon

      public Integer getResponseBufferSize()
    • setResponseBufferSize Link icon

      public void setResponseBufferSize(Integer responseBufferSize)
      To use a custom buffer size on the jakarta.servlet.ServletResponse.
    • isIgnoreResponseBody Link icon

      public boolean isIgnoreResponseBody()
    • setIgnoreResponseBody Link icon

      public void setIgnoreResponseBody(boolean ignoreResponseBody)
      If this option is true, The http producer won't read response body and cache the input stream.
    • isCopyHeaders Link icon

      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 Link icon

      public void setCopyHeaders(boolean copyHeaders)
    • isEagerCheckContentAvailable Link icon

      public boolean isEagerCheckContentAvailable()
    • setEagerCheckContentAvailable Link icon

      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 Link icon

      public String getOkStatusCodeRange()
    • setOkStatusCodeRange Link icon

      public void setOkStatusCodeRange(String okStatusCodeRange)
      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 Link icon

      public boolean isMapHttpMessageBody()
    • setMapHttpMessageBody Link icon

      public void setMapHttpMessageBody(boolean mapHttpMessageBody)
      If this option is true, the IN exchange body will be mapped to HTTP
    • isMapHttpMessageHeaders Link icon

      public boolean isMapHttpMessageHeaders()
    • setMapHttpMessageHeaders Link icon

      public void setMapHttpMessageHeaders(boolean mapHttpMessageHeaders)
      If this option is true, the IN exchange headers will be mapped to HTTP Headers
    • isMapHttpMessageFormUrlEncodedBody Link icon

      public boolean isMapHttpMessageFormUrlEncodedBody()
    • setMapHttpMessageFormUrlEncodedBody Link icon

      public void setMapHttpMessageFormUrlEncodedBody(boolean mapHttpMessageFormUrlEncodedBody)
      If this option is true then IN exchange Form Encoded body will be mapped to HTTP
    • isAsync Link icon

      public boolean isAsync()
    • setAsync Link icon

      public void setAsync(boolean async)
      If this option is true, the consumer will work in async mode
    • getCookieHandler Link icon

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

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

      public HttpMethods getHttpMethod()
    • setHttpMethod Link icon

      public void setHttpMethod(HttpMethods httpMethod)
      Configure the HTTP method to use. The HttpMethod header cannot override this option if set.
    • getAuthMethod Link icon

      public String getAuthMethod()
    • setAuthMethod Link icon

      public void setAuthMethod(String authMethod)
      Authentication methods allowed to use as a comma separated list of values Basic, Digest or NTLM.
    • getAuthMethodPriority Link icon

      public String getAuthMethodPriority()
    • setAuthMethodPriority Link icon

      public void setAuthMethodPriority(String authMethodPriority)
      Which authentication method to prioritize to use, either as Basic, Digest or NTLM.
    • getAuthUsername Link icon

      public String getAuthUsername()
    • setAuthUsername Link icon

      public void setAuthUsername(String authUsername)
      Authentication username
    • getAuthPassword Link icon

      public String getAuthPassword()
    • setAuthPassword Link icon

      public void setAuthPassword(String authPassword)
      Authentication password
    • getAuthDomain Link icon

      public String getAuthDomain()
    • setAuthDomain Link icon

      public void setAuthDomain(String authDomain)
      Authentication domain to use with NTML
    • getAuthHost Link icon

      public String getAuthHost()
    • setAuthHost Link icon

      public void setAuthHost(String authHost)
      Authentication host to use with NTML
    • getProxyAuthScheme Link icon

      public String getProxyAuthScheme()
    • setProxyAuthScheme Link icon

      public void setProxyAuthScheme(String proxyAuthScheme)
      Proxy authentication scheme to use
    • getProxyAuthMethod Link icon

      public String getProxyAuthMethod()
    • setProxyAuthMethod Link icon

      public void setProxyAuthMethod(String proxyAuthMethod)
      Proxy authentication method to use
    • getProxyAuthUsername Link icon

      public String getProxyAuthUsername()
    • setProxyAuthUsername Link icon

      public void setProxyAuthUsername(String proxyAuthUsername)
      Proxy authentication username
    • getProxyAuthPassword Link icon

      public String getProxyAuthPassword()
    • setProxyAuthPassword Link icon

      public void setProxyAuthPassword(String proxyAuthPassword)
      Proxy authentication password
    • getProxyAuthDomain Link icon

      public String getProxyAuthDomain()
    • setProxyAuthDomain Link icon

      public void setProxyAuthDomain(String proxyAuthDomain)
      Proxy authentication domain to use with NTML
    • getProxyAuthHost Link icon

      public String getProxyAuthHost()
    • setProxyAuthHost Link icon

      public void setProxyAuthHost(String proxyAuthHost)
      Proxy authentication host to use with NTML
    • getProxyAuthPort Link icon

      public int getProxyAuthPort()
    • setProxyAuthPort Link icon

      public void setProxyAuthPort(int proxyAuthPort)
      Proxy authentication port
    • getProxyHost Link icon

      public String getProxyHost()
    • setProxyHost Link icon

      public void setProxyHost(String proxyHost)
      Proxy hostname to use
    • getProxyPort Link icon

      public int getProxyPort()
    • setProxyPort Link icon

      public void setProxyPort(int proxyPort)
      Proxy port to use
    • getProxyAuthNtHost Link icon

      public String getProxyAuthNtHost()
    • setProxyAuthNtHost Link icon

      public void setProxyAuthNtHost(String proxyAuthNtHost)
      Proxy authentication domain (workstation name) to use with NTML
    • getOauth2ClientId Link icon

      public String getOauth2ClientId()
    • setOauth2ClientId Link icon

      public void setOauth2ClientId(String oauth2ClientId)
      OAuth2 Client id
    • getOauth2ClientSecret Link icon

      public String getOauth2ClientSecret()
    • setOauth2ClientSecret Link icon

      public void setOauth2ClientSecret(String oauth2ClientSecret)
      OAuth2 Client secret
    • getOauth2TokenEndpoint Link icon

      public String getOauth2TokenEndpoint()
    • setOauth2TokenEndpoint Link icon

      public void setOauth2TokenEndpoint(String oauth2TokenEndpoint)
      OAuth2 token endpoint
    • getOauth2Scope Link icon

      public String getOauth2Scope()
    • setOauth2Scope Link icon

      public void setOauth2Scope(String oauth2Scope)
      OAuth2 scope
    • isOauth2CacheTokens Link icon

      public boolean isOauth2CacheTokens()
    • setOauth2CacheTokens Link icon

      public void setOauth2CacheTokens(boolean oauth2CacheTokens)
      Whether to cache OAuth2 client tokens.
    • getOauth2CachedTokensDefaultExpirySeconds Link icon

      public long getOauth2CachedTokensDefaultExpirySeconds()
    • setOauth2CachedTokensDefaultExpirySeconds Link icon

      public void setOauth2CachedTokensDefaultExpirySeconds(long oauth2CachedTokensDefaultExpirySeconds)
      Default expiration time for cached OAuth2 tokens, in seconds. Used if token response does not contain 'expires_in' field.
    • getOauth2CachedTokensExpirationMarginSeconds Link icon

      public long getOauth2CachedTokensExpirationMarginSeconds()
    • setOauth2CachedTokensExpirationMarginSeconds Link icon

      public void setOauth2CachedTokensExpirationMarginSeconds(long cachedTokensExpirationMarginSeconds)
      Amount of time which is deducted from OAuth2 tokens expiry time to compensate for the time it takes OAuth2 Token Endpoint to send the token over http, in seconds. Set this parameter to high value if you OAuth2 Token Endpoint answers slowly or you tokens expire quickly. If you set this parameter to too small value, you can get 4xx http errors because camel will think that the received token is still valid, while in reality the token is expired for the Authentication server.