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() |
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
|
String |
getJsonDataFormat()
Gets the name of the json data format.
|
int |
getPort()
Gets the port to use by the REST consumer
|
RestConfiguration.RestHostNameResolver |
getRestHostNameResolver()
Gets the resolver to use for resolving hostname
|
String |
getScheme()
Gets the scheme to use by the REST consumer
|
String |
getXmlDataFormat()
Gets the name of the xml data format.
|
boolean |
isApiContextListing() |
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.
|
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 |
setApiProperties(Map<String,Object> apiProperties)
Sets additional options on api level
|
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 |
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 |
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 |
setRestHostNameResolver(RestConfiguration.RestHostNameResolver restHostNameResolver)
Sets the resolver to use for resolving hostname
|
void |
setRestHostNameResolver(String restHostNameResolver)
Sets the resolver to use for resolving hostname
|
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 |
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 getHost()
public void setHost(String host)
host
- the hostnamepublic 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)
EndpointHelper.matchPattern(String, String)
apiContextIdPattern
- the patternpublic boolean isApiContextListing()
public void setApiContextListing(boolean apiContextListing)
public RestConfiguration.RestHostNameResolver getRestHostNameResolver()
public void setRestHostNameResolver(RestConfiguration.RestHostNameResolver restHostNameResolver)
restHostNameResolver
- the resolverpublic void setRestHostNameResolver(String restHostNameResolver)
restHostNameResolver
- 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 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