@Metadata(label="rest") public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
Constructor and Description |
---|
RestDefinition() |
Modifier and Type | Method and Description |
---|---|
List<RouteDefinition> |
asRouteDefinition(CamelContext camelContext)
Transforms this REST definition into a list of
RouteDefinition which
Camel routing engine can add and run. |
RestDefinition |
bindingMode(RestBindingMode mode) |
RestDefinition |
consumes(String mediaType) |
RestDefinition |
delete() |
RestDefinition |
delete(String uri) |
RestDefinition |
description(String text)
Sets the description of this node
|
RestDefinition |
description(String id,
String text,
String lang)
Sets the description of this node
|
RestDefinition |
enableCORS(boolean enableCORS) |
RestDefinition |
get() |
RestDefinition |
get(String uri) |
RestBindingMode |
getBindingMode() |
String |
getConsumes() |
Boolean |
getEnableCORS() |
String |
getLabel()
Returns a label to describe this node such as the expression if some kind of expression node
|
String |
getPath() |
String |
getProduces() |
Boolean |
getSkipBindingOnErrorCode() |
List<VerbDefinition> |
getVerbs() |
RestDefinition |
head() |
RestDefinition |
head(String uri) |
RestDefinition |
id(String id)
Sets the id of this node
|
RestDefinition |
options() |
RestDefinition |
options(String uri) |
RestDefinition |
outType(Class<?> classType) |
RestDefinition |
outTypeList(Class<?> classType) |
RestDefinition |
path(String path)
To set the base path of this REST service
|
RestDefinition |
post() |
RestDefinition |
post(String uri) |
RestDefinition |
produces(String mediaType) |
RestDefinition |
put() |
RestDefinition |
put(String uri) |
RouteDefinition |
route() |
void |
setBindingMode(RestBindingMode bindingMode)
Sets the binding mode to use.
|
void |
setConsumes(String consumes)
To define the content type what the REST service consumes (accept as input), such as application/xml or application/json.
|
void |
setEnableCORS(Boolean enableCORS)
Whether to enable CORS headers in the HTTP response.
|
void |
setPath(String path)
Path of the rest service, such as "/foo"
|
void |
setProduces(String produces)
To define the content type what the REST service produces (uses for output), such as application/xml or application/json
This option will override what may be configured on a parent level
|
void |
setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode)
Whether to skip binding on output if there is a custom HTTP error code header.
|
void |
setVerbs(List<VerbDefinition> verbs)
The HTTP verbs this REST service accepts and uses
|
RestDefinition |
skipBindingOnErrorCode(boolean skipBindingOnErrorCode) |
RestDefinition |
to(String uri)
Routes directly to the given endpoint.
|
RestDefinition |
type(Class<?> classType) |
RestDefinition |
typeList(Class<?> classType) |
RestDefinition |
verb(String verb) |
RestDefinition |
verb(String verb,
String uri) |
getCustomId, getDescription, getDescriptionText, getId, getShortName, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setId
public RestDefinition()
public String getLabel()
NamedNode
public String getConsumes()
public void setConsumes(String consumes)
public String getProduces()
public void setProduces(String produces)
public RestBindingMode getBindingMode()
public void setBindingMode(RestBindingMode bindingMode)
public List<VerbDefinition> getVerbs()
public void setVerbs(List<VerbDefinition> verbs)
public Boolean getSkipBindingOnErrorCode()
public void setSkipBindingOnErrorCode(Boolean skipBindingOnErrorCode)
public Boolean getEnableCORS()
public void setEnableCORS(Boolean enableCORS)
public RestDefinition path(String path)
public RestDefinition get()
public RestDefinition get(String uri)
public RestDefinition post()
public RestDefinition post(String uri)
public RestDefinition put()
public RestDefinition put(String uri)
public RestDefinition delete()
public RestDefinition delete(String uri)
public RestDefinition head()
public RestDefinition head(String uri)
public RestDefinition options()
public RestDefinition options(String uri)
public RestDefinition verb(String verb)
public RestDefinition verb(String verb, String uri)
public RestDefinition id(String id)
OptionalIdentifiedDefinition
id
in class OptionalIdentifiedDefinition<RestDefinition>
id
- the idpublic RestDefinition description(String text)
OptionalIdentifiedDefinition
description
in class OptionalIdentifiedDefinition<RestDefinition>
text
- sets the text description, use null to not set a textpublic RestDefinition description(String id, String text, String lang)
OptionalIdentifiedDefinition
description
in class OptionalIdentifiedDefinition<RestDefinition>
id
- sets the id, use null to not set an idtext
- sets the text description, use null to not set a textlang
- sets the language for the description, use null to not set a languagepublic RestDefinition consumes(String mediaType)
public RestDefinition produces(String mediaType)
public RestDefinition type(Class<?> classType)
public RestDefinition typeList(Class<?> classType)
public RestDefinition outType(Class<?> classType)
public RestDefinition outTypeList(Class<?> classType)
public RestDefinition bindingMode(RestBindingMode mode)
public RestDefinition skipBindingOnErrorCode(boolean skipBindingOnErrorCode)
public RestDefinition enableCORS(boolean enableCORS)
public RestDefinition to(String uri)
route()
instead.uri
- the uri of the endpointpublic RouteDefinition route()
public List<RouteDefinition> asRouteDefinition(CamelContext camelContext)
RouteDefinition
which
Camel routing engine can add and run. This allows us to define REST services using this
REST DSL and turn those into regular Camel routes.Apache Camel