org.apache.camel.model.rest
Class RestDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition<RestDefinition>
      extended by org.apache.camel.model.rest.RestDefinition
All Implemented Interfaces:
NamedNode

public class RestDefinition
extends OptionalIdentifiedDefinition<RestDefinition>

Represents an XML <rest/> element


Constructor Summary
RestDefinition()
           
 
Method Summary
 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 get()
           
 RestDefinition get(String uri)
           
 RestBindingMode getBindingMode()
           
 String getConsumes()
           
 String getLabel()
          Returns a label to describe this node such as the expression if some kind of expression node
 String getPath()
           
 String getProduces()
           
 List<VerbDefinition> getVerbs()
           
 RestDefinition head()
           
 RestDefinition head(String uri)
           
 RestDefinition id(String id)
          Sets the id of this node
 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)
           
 void setConsumes(String consumes)
           
 void setPath(String path)
           
 void setProduces(String produces)
           
 void setVerbs(List<VerbDefinition> verbs)
           
 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)
           
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
getDescription, getDescriptionText, getId, getShortName, hasCustomIdAssigned, idOrCreate, isCustomId, setCustomId, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestDefinition

public RestDefinition()
Method Detail

getLabel

public String getLabel()
Description copied from interface: NamedNode
Returns a label to describe this node such as the expression if some kind of expression node


getPath

public String getPath()

setPath

public void setPath(String path)

getConsumes

public String getConsumes()

setConsumes

public void setConsumes(String consumes)

getProduces

public String getProduces()

setProduces

public void setProduces(String produces)

getBindingMode

public RestBindingMode getBindingMode()

setBindingMode

public void setBindingMode(RestBindingMode bindingMode)

getVerbs

public List<VerbDefinition> getVerbs()

setVerbs

public void setVerbs(List<VerbDefinition> verbs)

path

public RestDefinition path(String path)
To set the base path of this REST service


get

public RestDefinition get()

get

public RestDefinition get(String uri)

post

public RestDefinition post()

post

public RestDefinition post(String uri)

put

public RestDefinition put()

put

public RestDefinition put(String uri)

delete

public RestDefinition delete()

delete

public RestDefinition delete(String uri)

head

public RestDefinition head()

head

public RestDefinition head(String uri)

verb

public RestDefinition verb(String verb)

verb

public RestDefinition verb(String verb,
                           String uri)

id

public RestDefinition id(String id)
Description copied from class: OptionalIdentifiedDefinition
Sets the id of this node

Overrides:
id in class OptionalIdentifiedDefinition<RestDefinition>
Parameters:
id - the id
Returns:
the builder

description

public RestDefinition description(String text)
Description copied from class: OptionalIdentifiedDefinition
Sets the description of this node

Overrides:
description in class OptionalIdentifiedDefinition<RestDefinition>
Parameters:
text - sets the text description, use null to not set a text
Returns:
the builder

description

public RestDefinition description(String id,
                                  String text,
                                  String lang)
Description copied from class: OptionalIdentifiedDefinition
Sets the description of this node

Overrides:
description in class OptionalIdentifiedDefinition<RestDefinition>
Parameters:
id - sets the id, use null to not set an id
text - sets the text description, use null to not set a text
lang - sets the language for the description, use null to not set a language
Returns:
the builder

consumes

public RestDefinition consumes(String mediaType)

produces

public RestDefinition produces(String mediaType)

type

public RestDefinition type(Class<?> classType)

typeList

public RestDefinition typeList(Class<?> classType)

outType

public RestDefinition outType(Class<?> classType)

outTypeList

public RestDefinition outTypeList(Class<?> classType)

bindingMode

public RestDefinition bindingMode(RestBindingMode mode)

to

public RestDefinition to(String uri)
Routes directly to the given endpoint.

If you need additional routing capabilities, then use route() instead.

Parameters:
uri - the uri of the endpoint
Returns:
this builder

route

public RouteDefinition route()

asRouteDefinition

public List<RouteDefinition> asRouteDefinition(CamelContext camelContext)
                                        throws Exception
Transforms this REST definition into a list of 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.

Throws:
Exception


Apache Camel