public class DefaultSparkBinding extends Object implements SparkBinding
| Constructor and Description |
|---|
DefaultSparkBinding() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
mapKey(String key) |
void |
populateCamelHeaders(spark.Request request,
Map<String,Object> headers,
org.apache.camel.Exchange exchange,
SparkConfiguration configuration)
Binds from Spark
Request to Camel headers as a Map. |
protected String |
shouldUrlDecodeHeader(SparkConfiguration configuration,
String headerName,
Object value,
String charset)
Decodes the header if needed to, or returns the header value as is.
|
org.apache.camel.Message |
toCamelMessage(spark.Request request,
org.apache.camel.Exchange exchange,
SparkConfiguration configuration)
Binds from Spark
Request to Camel Message. |
void |
toSparkResponse(org.apache.camel.Message message,
spark.Response response,
SparkConfiguration configuration)
Binds from Camel
Message to Spark Response. |
public org.apache.camel.Message toCamelMessage(spark.Request request,
org.apache.camel.Exchange exchange,
SparkConfiguration configuration)
throws Exception
SparkBindingRequest to Camel Message.toCamelMessage in interface SparkBindingrequest - the Spark requestexchange - the exchange that should contain the returned message.configuration - configurationException - is thrown if error during bindingpublic void populateCamelHeaders(spark.Request request,
Map<String,Object> headers,
org.apache.camel.Exchange exchange,
SparkConfiguration configuration)
throws Exception
SparkBindingRequest to Camel headers as a Map.populateCamelHeaders in interface SparkBindingrequest - the Spark requestheaders - the Camel headers that should be populatedexchange - the exchange that should contain the returned message.configuration - the endpoint configurationException - is thrown if error during bindingpublic void toSparkResponse(org.apache.camel.Message message,
spark.Response response,
SparkConfiguration configuration)
throws Exception
SparkBindingMessage to Spark Response.toSparkResponse in interface SparkBindingmessage - the Camel messageresponse - the Spark response to bind toconfiguration - the endpoint configurationException - is thrown if error during bindingprotected String shouldUrlDecodeHeader(SparkConfiguration configuration, String headerName, Object value, String charset) throws UnsupportedEncodingException
configuration - the configurationheaderName - the header namevalue - the current header valuecharset - the charset to use for decodingUnsupportedEncodingException - is thrown if error decoding.Apache Camel