Class DefaultNettyHttpBinding
java.lang.Object
org.apache.camel.component.netty.http.DefaultNettyHttpBinding
- All Implemented Interfaces:
Cloneable,NettyHttpBinding
- Direct Known Subclasses:
RestNettyHttpBinding
Default
NettyHttpBinding.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultNettyHttpBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) -
Method Summary
Modifier and TypeMethodDescriptioncopy()protected voidcopyCamelHeaders(Map<String, Object> headers, org.apache.camel.Exchange exchange) Copy camel header from exchange to headers map.org.apache.camel.spi.HeaderFilterStrategyGets the header filter strategyvoidpopulateCamelHeaders(io.netty.handler.codec.http.HttpRequest request, Map<String, Object> headers, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyHttpRequestto Camel headers as aMap.voidpopulateCamelHeaders(io.netty.handler.codec.http.HttpResponse response, Map<String, Object> headers, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyHttpResponseto Camel headers as aMap.voidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) Sets the header filter strategy to use.protected StringshouldUrlDecodeHeader(NettyHttpConfiguration configuration, String headerName, Object value, String charset) Deprecated.protected StringshouldUrlDecodeHeader(NettyHttpConfiguration configuration, String headerName, Object value, Charset charset) Decodes the header if needed to, or returns the header value as is.org.apache.camel.MessagetoCamelMessage(io.netty.handler.codec.http.FullHttpRequest request, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyHttpRequestto CamelMessage.org.apache.camel.MessagetoCamelMessage(io.netty.handler.codec.http.FullHttpResponse response, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyHttpResponseto CamelMessage.org.apache.camel.MessagetoCamelMessage(InboundStreamHttpRequest request, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyInboundStreamHttpRequestto CamelMessage.org.apache.camel.MessagetoCamelMessage(InboundStreamHttpResponse response, org.apache.camel.Exchange exchange, NettyHttpConfiguration configuration) Binds from NettyInboundStreamHttpResponseto CamelMessage.io.netty.handler.codec.http.HttpRequesttoNettyRequest(org.apache.camel.Message message, String fullUri, NettyHttpConfiguration configuration) Binds from CamelMessageto NettyHttpRequest.io.netty.handler.codec.http.HttpResponsetoNettyResponse(org.apache.camel.Message message, NettyHttpConfiguration configuration) Binds from CamelMessageto NettyHttpResponse.
-
Constructor Details
-
DefaultNettyHttpBinding
public DefaultNettyHttpBinding() -
DefaultNettyHttpBinding
public DefaultNettyHttpBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
-
-
Method Details
-
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:NettyHttpBindingBinds from NettyHttpRequestto CamelMessage. Will use the populateCamelHeaders method for populating the headers.- Specified by:
toCamelMessagein interfaceNettyHttpBinding- Parameters:
request- the netty http requestexchange- 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:NettyHttpBindingBinds from NettyInboundStreamHttpRequestto CamelMessage.- Specified by:
toCamelMessagein interfaceNettyHttpBinding- Parameters:
request- the netty http requestexchange- 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 ExceptionDescription copied from interface:NettyHttpBindingBinds from NettyHttpRequestto Camel headers as aMap. Will use the populateCamelHeaders method for populating the headers.- Specified by:
populateCamelHeadersin interfaceNettyHttpBinding- Parameters:
request- the netty http requestheaders- the Camel headers that should be populatedexchange- the exchange that should contain the returned message.configuration- the endpoint configuration- Throws:
Exception- is thrown if error during binding
-
copyCamelHeaders
Copy camel header from exchange to headers map.- Parameters:
headers- the map headersexchange- 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 configurationheaderName- the header namevalue- the current header valuecharset- 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 configurationheaderName- the header namevalue- the current header valuecharset- 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:NettyHttpBindingBinds from NettyHttpResponseto CamelMessage. Will use the populateCamelHeaders method for populating the headers.- Specified by:
toCamelMessagein interfaceNettyHttpBinding- Parameters:
response- the netty http responseexchange- 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:NettyHttpBindingBinds from NettyInboundStreamHttpResponseto CamelMessage. Will use the populateCamelHeaders method for populating the headers.- Specified by:
toCamelMessagein interfaceNettyHttpBinding- Parameters:
response- the netty http responseexchange- 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:NettyHttpBindingBinds from NettyHttpResponseto Camel headers as aMap.- Specified by:
populateCamelHeadersin interfaceNettyHttpBinding- Parameters:
response- the netty http responseheaders- the Camel headers that should be populatedexchange- 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:NettyHttpBindingBinds from CamelMessageto NettyHttpResponse.- Specified by:
toNettyResponsein interfaceNettyHttpBinding- Parameters:
message- the Camel messageconfiguration- 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:NettyHttpBindingBinds from CamelMessageto NettyHttpRequest.- Specified by:
toNettyRequestin interfaceNettyHttpBinding- Parameters:
message- the Camel messagefullUri- the uri which is the intended uri to call, though the message may override the uriconfiguration- 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:NettyHttpBindingGets the header filter strategy- Specified by:
getHeaderFilterStrategyin interfaceNettyHttpBinding- Returns:
- the strategy
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) Description copied from interface:NettyHttpBindingSets the header filter strategy to use.- Specified by:
setHeaderFilterStrategyin interfaceNettyHttpBinding- Parameters:
headerFilterStrategy- the custom strategy
-
shouldUrlDecodeHeader(NettyHttpConfiguration, String, Object, Charset)