Nav

REST Component Reference

Purpose: Use a REST API to publish an external RESTful web service.

Minimum Configuration: Specify the REST component or resource class.

A REST component publishes a RESTful web service via JAX-RS annotations and using Jersey. In addition to specifying the REST component class, you can also configure an exception mapper and a interceptor.

Note that REST is a formal HTTP architecture based on resources, links, and a uniform interface. As such, it uses the HTTP protocol.

Mule hosts RESTful web services using Jersey, which is a JAX-RS (JSR-311) implementation. JAX-RS is a specification that provides a series of annotations and classes that make it possible to build RESTful services.

Generally, you add a REST component to an connector. If you add the REST component to a request-response connector, such as an HTTP connector, Anypoint Studio generates a REST request-response component, as shown below.

rest

If you add the REST component to a one-way connector, such as a File connector, then Anypoint Studio generates a REST one-way component. 

Open the REST component’s Properties Editor. Use the General tab to specify the reference to the REST component or resource and, if you are using exception mapping, the class implementing this mapping.

rest_general

See Also

In this topic: