This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Rest DSL

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OptionDefaultDescription

component

 

The Camel Rest component to use for the REST transport, such as restlet, spark-rest.

If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry. If either one is found, then that is being used.

scheme

http

The scheme to use for exposing the REST service. Usually http or https is supported

hostname

 

The hostname to use for exposing the REST service.

port

 

The port number to use for exposing the REST service.

Info

Note: if you use servlet component then the port number configured here does not apply, as the port number in use is the actual port number the servlet component is using, e.g., if using Apache Tomcat its the tomcat HTTP port, if using Apache Karaf it's the HTTP service in Karaf that uses port 8181 by default etc. Though in those situations setting the port number here, allows tooling and JMX to know the port number, so its recommended to set the port number to the number that the servlet engine uses.

contextPath

 

Sets a leading context-path the REST services will be using. This can be used when using components such as SERVLET where the deployed web application is deployed using a context-path.

restHostNameResolver

 

If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using.

The resolver supports:

  • allLocalIp (from Camel 2.17)
  • localHostName
  • localIp

For Camel 2.16.x or older: localHostName

From Camel 2.17allLocalIp

bindingMode

off

Whether binding is in use. See further above for more details.

skipBindingOnErrorCode

true

Camel 2.14.1: Whether to skip binding on output if there is a custom HTTP error code header.

This allows to build custom error messages that do not bind to JSON/XML etc, as success messages otherwise will do.

See below for an example.

enableCORS

false

Camel 2.14.1: Whether to enable CORS headers in the HTTP response.

jsonDataFormat

 

Name of specific JSON data format to use. By default json-jackson will be used.

Warning

Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance.

Info

Note: Currently Jackson is what we recommend and are using for testing.

xmlDataFormat

 

Name of specific XML data format to use. By default jaxb will be used.

Warning

Important: This option is only for setting a custom name of the data format, not to refer to an existing data format instance.

Info

Note: Currently only jaxb is supported.

componentProperty

 

Allows to configure as many additional properties. This is used to configure component specific options such as for Restlet / Spark-Rest etc. The options value can use the # notation to refer to a bean to lookup in the  Registry 

endpointProperty

 

Allows to configure as many additional properties. This is used to configure endpoint specific options for  Restlet / Spark-Rest etc. The options value can use the # notation to refer to a bean to lookup in the  Registry 

consumerProperty

 

Allows to configure as many additional properties. This is used to configure consumer specific options for  Restlet / Spark-Rest etc. The options value can use the # notation to refer to a bean to lookup in the  Registry 

dataFormatProperty

 

Allows to configure as many additional properties. This is used to configure the data format specific options.

For example set property prettyPrint=true to have JSON outputted in pretty mode.

From Camel 2.14.1: the keys can be prefixed with either:

  • json.in.

  • json.out.

  • xml.in.

  • xml.out.

to denote that the option is only for either JSON or XML data format, and only for either the in or the out going. For example a key with value xml.out.mustBeJAXBElement is only for the XML data format for the outgoing.

A key without a prefix is a common key for all situations.

From Camel 2.17: the options value can use the # notation to refer to a bean to lookup in the Registry

corsHeaderProperty

 

Allows to configure custom CORS headers.

...

KeyValue

Access-Control-Allow-Origin

*

Access-Control-Allow-Methods

GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECTPATCH

Access-Control-Allow-Headers

Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-MethodAccess-Control-Request-Headers

Access-Control-Max-Age

3600

 

Defining a Custom Error Message As-is

...