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.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

public abstract class HttpCommonEndpoint extends org.apache.camel.support.DefaultEndpoint implements org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.cloud.DiscoverableService
  • Constructor Details

    • HttpCommonEndpoint

      protected HttpCommonEndpoint()
    • HttpCommonEndpoint

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

    • connect

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

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

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

      public HttpCommonComponent getComponent()
      Overrides:
      getComponent in class org.apache.camel.support.DefaultEndpoint
    • isLenientProperties

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

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

      @Deprecated public HttpBinding getBinding()
      Deprecated.
    • getHttpBinding

      public HttpBinding getHttpBinding()
    • setHttpBinding

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

      public String getPath()
    • getPort

      public int getPort()
    • getProtocol

      public String getProtocol()
    • getHttpUri

      public URI getHttpUri()
    • setHttpUri

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

      public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
      Specified by:
      getHeaderFilterStrategy in interface org.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 interface org.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

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

      public Integer getResponseBufferSize()
    • setResponseBufferSize

      public void setResponseBufferSize(Integer responseBufferSize)
      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

      public String getOkStatusCodeRange()
    • setOkStatusCodeRange

      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

      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

      public HttpMethods getHttpMethod()
    • setHttpMethod

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

      public String getAuthMethod()
    • setAuthMethod

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

      public String getAuthMethodPriority()
    • setAuthMethodPriority

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

      public String getAuthUsername()
    • setAuthUsername

      public void setAuthUsername(String authUsername)
      Authentication username
    • getAuthPassword

      public String getAuthPassword()
    • setAuthPassword

      public void setAuthPassword(String authPassword)
      Authentication password
    • getAuthDomain

      public String getAuthDomain()
    • setAuthDomain

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

      public String getAuthHost()
    • setAuthHost

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

      public String getProxyAuthScheme()
    • setProxyAuthScheme

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

      public String getProxyAuthMethod()
    • setProxyAuthMethod

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

      public String getProxyAuthUsername()
    • setProxyAuthUsername

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

      public String getProxyAuthPassword()
    • setProxyAuthPassword

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

      public String getProxyAuthDomain()
    • setProxyAuthDomain

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

      public String getProxyAuthHost()
    • setProxyAuthHost

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

      public int getProxyAuthPort()
    • setProxyAuthPort

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

      public String getProxyHost()
    • setProxyHost

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

      public int getProxyPort()
    • setProxyPort

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

      public String getProxyAuthNtHost()
    • setProxyAuthNtHost

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