public class RestConfiguration extends Object
RestConsumerFactory
and RestApiConsumerFactory
for Camel components to support the Camel rest
DSL.Modifier and Type | Class and Description |
---|---|
static class |
RestConfiguration.RestBindingMode |
static class |
RestConfiguration.RestHostNameResolver |
Modifier and Type | Field and Description |
---|---|
static String |
CORS_ACCESS_CONTROL_ALLOW_HEADERS |
static String |
CORS_ACCESS_CONTROL_ALLOW_METHODS |
static String |
CORS_ACCESS_CONTROL_ALLOW_ORIGIN |
static String |
CORS_ACCESS_CONTROL_MAX_AGE |
Constructor and Description |
---|
RestConfiguration() |
Modifier and Type | Method and Description |
---|---|
String |
getApiComponent()
Gets the name of the Camel component to use as the REST API (such as swagger)
|
String |
getApiContextIdPattern() |
String |
getApiContextPath() |
String |
getApiContextRouteId() |
String |
getApiHost() |
Map<String,Object> |
getApiProperties() |
RestConfiguration.RestBindingMode |
getBindingMode()
Gets the binding mode used by the REST consumer
|
String |
getComponent()
Gets the name of the Camel component to use as the REST consumer
|
Map<String,Object> |
getComponentProperties()
Gets additional options on component level
|
Map<String,Object> |
getConsumerProperties()
Gets additional options on consumer level
|
String |
getContextPath()
Gets the configured context-path
|
Map<String,String> |
getCorsHeaders()
Gets the CORS headers to use if CORS has been enabled.
|
Map<String,Object> |
getDataFormatProperties()
Gets additional options on data format level
|
Map<String,Object> |
getEndpointProperties()
Gets additional options on endpoint level
|
String |
getHost()
Gets the hostname to use by the REST consumer
|
RestConfiguration.RestHostNameResolver |
getHostNameResolver()
Gets the resolver to use for resolving hostname
|
String |
getJsonDataFormat()
Gets the name of the json data format.
|
int |
getPort()
Gets the port to use by the REST consumer
|
String |
getProducerApiDoc()
Gets the location of the api document (swagger api) the REST producer will use
to validate the REST uri and query parameters are valid accordingly to the api document.
|
String |
getProducerComponent()
Gets the name of the Camel component to use as the REST producer
|
String |
getScheme()
Gets the scheme to use by the REST consumer
|
String |
getXmlDataFormat()
Gets the name of the xml data format.
|
boolean |
isApiContextListing() |
boolean |
isApiVendorExtension() |
boolean |
isClientRequestValidation() |
boolean |
isEnableCORS()
To specify whether to enable CORS which means Camel will automatic include CORS in the HTTP headers in the response.
|
boolean |
isSkipBindingOnErrorCode()
Whether to skip binding output if there is a custom HTTP error code, and instead use the response body as-is.
|
boolean |
isUseXForwardHeaders()
WWhether to use X-Forward headers to set host etc.
|
void |
setApiComponent(String apiComponent)
Sets the name of the Camel component to use as the REST API (such as swagger)
|
void |
setApiContextIdPattern(String apiContextIdPattern)
Optional CamelContext id pattern to only allow Rest APIs from rest services within CamelContext's which name matches the pattern.
|
void |
setApiContextListing(boolean apiContextListing)
Sets whether listing of all available CamelContext's with REST services in the JVM is enabled.
|
void |
setApiContextPath(String contextPath)
Sets a leading API context-path the REST API services will be using.
|
void |
setApiContextRouteId(String apiContextRouteId)
Sets the route id to use for the route that services the REST API.
|
void |
setApiHost(String apiHost)
To use an specific hostname for the API documentation (eg swagger)
This can be used to override the generated host with this configured hostname
|
void |
setApiProperties(Map<String,Object> apiProperties)
Sets additional options on api level
|
void |
setApiVendorExtension(boolean apiVendorExtension)
Whether vendor extension is enabled in the Rest APIs.
|
void |
setBindingMode(RestConfiguration.RestBindingMode bindingMode)
Sets the binding mode to be used by the REST consumer
|
void |
setBindingMode(String bindingMode)
Sets the binding mode to be used by the REST consumer
|
void |
setClientRequestValidation(boolean clientRequestValidation)
Whether to enable validation of the client request to check whether the Content-Type and Accept headers from
the client is supported by the Rest-DSL configuration of its consumes/produces settings.
|
void |
setComponent(String componentName)
Sets the name of the Camel component to use as the REST consumer
|
void |
setComponentProperties(Map<String,Object> componentProperties)
Sets additional options on component level
|
void |
setConsumerProperties(Map<String,Object> consumerProperties)
Sets additional options on consumer level
|
void |
setContextPath(String contextPath)
Sets a leading context-path the REST services will be using.
|
void |
setCorsHeaders(Map<String,String> corsHeaders)
Sets the CORS headers to use if CORS has been enabled.
|
void |
setDataFormatProperties(Map<String,Object> dataFormatProperties)
Sets additional options on data format level
|
void |
setEnableCORS(boolean enableCORS)
To specify whether to enable CORS which means Camel will automatic include CORS in the HTTP headers in the response.
|
void |
setEndpointProperties(Map<String,Object> endpointProperties)
Sets additional options on endpoint level
|
void |
setHost(String host)
Sets the hostname to use by the REST consumer
|
void |
setHostNameResolver(RestConfiguration.RestHostNameResolver hostNameResolver)
Sets the resolver to use for resolving hostname
|
void |
setHostNameResolver(String hostNameResolver)
Sets the resolver to use for resolving hostname
|
void |
setJsonDataFormat(String name)
Sets a custom json data format to be used
Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance.
|
void |
setPort(int port)
Sets the port to use by the REST consumer
|
void |
setProducerApiDoc(String producerApiDoc)
Sets the location of the api document (swagger api) the REST producer will use
to validate the REST uri and query parameters are valid accordingly to the api document.
|
void |
setProducerComponent(String componentName)
Sets the name of the Camel component to use as the REST producer
|
void |
setScheme(String scheme)
Sets the scheme to use by the REST consumer
|
void |
setSkipBindingOnErrorCode(boolean skipBindingOnErrorCode)
Whether to skip binding output if there is a custom HTTP error code, and instead use the response body as-is.
|
void |
setUseXForwardHeaders(boolean useXForwardHeaders)
WWhether to use X-Forward headers to set host etc.
|
void |
setXmlDataFormat(String name)
Sets a custom xml data format to be used.
|
public static final String CORS_ACCESS_CONTROL_ALLOW_ORIGIN
public static final String CORS_ACCESS_CONTROL_ALLOW_METHODS
public static final String CORS_ACCESS_CONTROL_MAX_AGE
public static final String CORS_ACCESS_CONTROL_ALLOW_HEADERS
public RestConfiguration()
public String getComponent()
Registry
to find suitable implementationpublic void setComponent(String componentName)
componentName
- the name of the component (such as restlet, spark-rest, etc.)public String getApiComponent()
public void setApiComponent(String apiComponent)
apiComponent
- the name of the component (such as swagger)public String getProducerComponent()
Registry
to find suitable implementationpublic void setProducerComponent(String componentName)
componentName
- the name of the component (such as restlet, jetty, etc.)public String getProducerApiDoc()
public void setProducerApiDoc(String producerApiDoc)
public String getHost()
public void setHost(String host)
host
- the hostnamepublic boolean isUseXForwardHeaders()
public void setUseXForwardHeaders(boolean useXForwardHeaders)
useXForwardHeaders
- whether to use X-Forward headerspublic String getApiHost()
public void setApiHost(String apiHost)
public String getScheme()
public void setScheme(String scheme)
scheme
- the schemepublic int getPort()
public void setPort(int port)
port
- the port numberpublic String getContextPath()
public void setContextPath(String contextPath)
contextPath
- the context pathpublic String getApiContextPath()
public void setApiContextPath(String contextPath)
contextPath
- the API context pathpublic String getApiContextRouteId()
public void setApiContextRouteId(String apiContextRouteId)
apiContextRouteId
- the route idpublic String getApiContextIdPattern()
public void setApiContextIdPattern(String apiContextIdPattern)
org.apache.camel.support.EndpointHelper#matchPattern(String, String)
apiContextIdPattern
- the patternpublic boolean isApiContextListing()
public void setApiContextListing(boolean apiContextListing)
public boolean isApiVendorExtension()
public void setApiVendorExtension(boolean apiVendorExtension)
public RestConfiguration.RestHostNameResolver getHostNameResolver()
public void setHostNameResolver(RestConfiguration.RestHostNameResolver hostNameResolver)
hostNameResolver
- the resolverpublic void setHostNameResolver(String hostNameResolver)
hostNameResolver
- the resolverpublic RestConfiguration.RestBindingMode getBindingMode()
public void setBindingMode(RestConfiguration.RestBindingMode bindingMode)
bindingMode
- the binding modepublic void setBindingMode(String bindingMode)
bindingMode
- the binding modepublic boolean isSkipBindingOnErrorCode()
public void setSkipBindingOnErrorCode(boolean skipBindingOnErrorCode)
skipBindingOnErrorCode
- whether to skip binding on error codepublic boolean isClientRequestValidation()
public void setClientRequestValidation(boolean clientRequestValidation)
public boolean isEnableCORS()
public void setEnableCORS(boolean enableCORS)
enableCORS
- true to enable CORSpublic String getJsonDataFormat()
public void setJsonDataFormat(String name)
name
- name of the data formatpublic String getXmlDataFormat()
public void setXmlDataFormat(String name)
name
- name of the data formatpublic Map<String,Object> getComponentProperties()
public void setComponentProperties(Map<String,Object> componentProperties)
componentProperties
- the optionspublic Map<String,Object> getEndpointProperties()
public void setEndpointProperties(Map<String,Object> endpointProperties)
endpointProperties
- the optionspublic Map<String,Object> getConsumerProperties()
public void setConsumerProperties(Map<String,Object> consumerProperties)
consumerProperties
- the optionspublic Map<String,Object> getDataFormatProperties()
public void setDataFormatProperties(Map<String,Object> dataFormatProperties)
dataFormatProperties
- the optionspublic Map<String,Object> getApiProperties()
public void setApiProperties(Map<String,Object> apiProperties)
apiProperties
- the optionspublic Map<String,String> getCorsHeaders()
public void setCorsHeaders(Map<String,String> corsHeaders)
corsHeaders
- the CORS headersApache Camel