Class DefaultNettyHttpBinding

java.lang.Object
org.apache.camel.component.netty.http.DefaultNettyHttpBinding
All Implemented Interfaces:
Cloneable, NettyHttpBinding
Direct Known Subclasses:
RestNettyHttpBinding

public class DefaultNettyHttpBinding extends Object implements NettyHttpBinding, Cloneable
  • Constructor Details

    • DefaultNettyHttpBinding

      public DefaultNettyHttpBinding()
    • DefaultNettyHttpBinding

      public DefaultNettyHttpBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
  • Method Details

    • copy

      public DefaultNettyHttpBinding copy()
    • toCamelMessage

      public org.apache.camel.Message toCamelMessage(io.netty.handler.codec.http.FullHttpRequest request, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) throws Exception
      Description copied from interface: NettyHttpBinding
      Binds from Netty HttpRequest to Camel Message.

      Will use the populateCamelHeaders method for populating the headers.

      Specified by:
      toCamelMessage in interface NettyHttpBinding
      Parameters:
      request - the netty http request
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
      Returns:
      the message to store on the given exchange
      Throws:
      Exception - is thrown if error during binding
    • toCamelMessage

      public org.apache.camel.Message toCamelMessage(InboundStreamHttpRequest request, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) throws Exception
      Description copied from interface: NettyHttpBinding
      Binds from Netty InboundStreamHttpRequest to Camel Message.

      Specified by:
      toCamelMessage in interface NettyHttpBinding
      Parameters:
      request - the netty http request
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
      Returns:
      the message to store on the given exchange
      Throws:
      Exception - is thrown if error during binding
    • populateCamelHeaders

      public void populateCamelHeaders(io.netty.handler.codec.http.HttpRequest request, Map<String,Object> headers, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) throws Exception
      Description copied from interface: NettyHttpBinding
      Binds from Netty HttpRequest to Camel headers as a Map. Will use the populateCamelHeaders method for populating the headers.
      Specified by:
      populateCamelHeaders in interface NettyHttpBinding
      Parameters:
      request - the netty http request
      headers - the Camel headers that should be populated
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
      Throws:
      Exception - is thrown if error during binding
    • copyCamelHeaders

      protected void copyCamelHeaders(Map<String,Object> headers, org.apache.camel.Exchange exchange)
      Copy camel header from exchange to headers map.
      Parameters:
      headers - the map headers
      exchange - the exchange
    • shouldUrlDecodeHeader

      @Deprecated(since="4.4.0") protected String shouldUrlDecodeHeader(NettyHttpConfiguration configuration, String headerName, Object value, String charset) throws UnsupportedEncodingException
      Decodes the header if needed to, or returns the header value as is.
      Parameters:
      configuration - the configuration
      headerName - the header name
      value - the current header value
      charset - the charset to use for decoding
      Returns:
      the decoded value (if decoded was needed) or a toString representation of the value.
      Throws:
      UnsupportedEncodingException - is thrown if error decoding.
    • shouldUrlDecodeHeader

      protected String shouldUrlDecodeHeader(NettyHttpConfiguration configuration, String headerName, Object value, Charset charset)
      Decodes the header if needed to, or returns the header value as is.
      Parameters:
      configuration - the configuration
      headerName - the header name
      value - the current header value
      charset - the charset to use for decoding
      Returns:
      the decoded value (if decoded was needed) or a toString representation of the value.
    • toCamelMessage

      public org.apache.camel.Message toCamelMessage(io.netty.handler.codec.http.FullHttpResponse response, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration)
      Description copied from interface: NettyHttpBinding
      Binds from Netty HttpResponse to Camel Message.

      Will use the populateCamelHeaders method for populating the headers.

      Specified by:
      toCamelMessage in interface NettyHttpBinding
      Parameters:
      response - the netty http response
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
      Returns:
      the message to store on the given exchange
    • toCamelMessage

      public org.apache.camel.Message toCamelMessage(InboundStreamHttpResponse response, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration)
      Description copied from interface: NettyHttpBinding
      Binds from Netty InboundStreamHttpResponse to Camel Message.

      Will use the populateCamelHeaders method for populating the headers.

      Specified by:
      toCamelMessage in interface NettyHttpBinding
      Parameters:
      response - the netty http response
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
      Returns:
      the message to store on the given exchange
    • populateCamelHeaders

      public void populateCamelHeaders(io.netty.handler.codec.http.HttpResponse response, Map<String,Object> headers, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration)
      Description copied from interface: NettyHttpBinding
      Binds from Netty HttpResponse to Camel headers as a Map.
      Specified by:
      populateCamelHeaders in interface NettyHttpBinding
      Parameters:
      response - the netty http response
      headers - the Camel headers that should be populated
      exchange - the exchange that should contain the returned message.
      configuration - the endpoint configuration
    • toNettyResponse

      public io.netty.handler.codec.http.HttpResponse toNettyResponse(org.apache.camel.Message message, NettyHttpConfiguration configuration) throws Exception
      Description copied from interface: NettyHttpBinding
      Binds from Camel Message to Netty HttpResponse.
      Specified by:
      toNettyResponse in interface NettyHttpBinding
      Parameters:
      message - the Camel message
      configuration - the endpoint configuration
      Returns:
      the http response
      Throws:
      Exception - is thrown if error during binding
    • toNettyRequest

      public io.netty.handler.codec.http.HttpRequest toNettyRequest(org.apache.camel.Message message, String fullUri, NettyHttpConfiguration configuration) throws Exception
      Description copied from interface: NettyHttpBinding
      Binds from Camel Message to Netty HttpRequest.
      Specified by:
      toNettyRequest in interface NettyHttpBinding
      Parameters:
      message - the Camel message
      fullUri - the uri which is the intended uri to call, though the message may override the uri
      configuration - the endpoint configuration
      Returns:
      the http request
      Throws:
      Exception - is thrown if error during binding
    • getHeaderFilterStrategy

      public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
      Description copied from interface: NettyHttpBinding
      Gets the header filter strategy
      Specified by:
      getHeaderFilterStrategy in interface NettyHttpBinding
      Returns:
      the strategy
    • setHeaderFilterStrategy

      public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
      Description copied from interface: NettyHttpBinding
      Sets the header filter strategy to use.
      Specified by:
      setHeaderFilterStrategy in interface NettyHttpBinding
      Parameters:
      headerFilterStrategy - the custom strategy