Representational State Transfer

Representational State Transfer (REST) leverages the capabilities of Hypertext Transfer Protocol (HTTP) and Uniform Resource Identifiers (URIs) to retrieve or modify the state of a resource. The metadata for data transfer is predefined by the representational metadata for the resources or resource methods.

Java API for RESTful web services

The Java™ API for RESTful Web Services (JAX-RS) provides Java API support for creating web services according to the REST architectural style. JAX-RS uses Java annotations to simplify the development and deployment of RESTful web services.

JAX-RS provides annotations for mapping a resource class or a plain old Java object (POJO) as a web resource. For information about the annotations that are included in the API, see the link to the related reference topic that describes the mapping between the stereotypes in the JAX-RS profile and the annotations.

By using JAX-RS, a web resource is implemented as a resource class, and requests are handled by resource methods.

REST reference library

The REST reference library specifies the media types that you can use for input and output types of REST resources. Each media type indicates the supported parameter types and error codes for resource methods.

To view the supported media and parameter types in the reference library, create a UML model by using the REST template model, and in the generated model, expand RestReference.

JAX-RS reference library

The JAX-RS reference library contains domain-specific types that you can add to elements in a model. To view the types in the JAX-RS reference library, create a UML model by using the JAX-RS template model, and in the generated model, expand JAX-RSReference.

Considerations when modeling JAX-RS types

The following conditions must be met for a JAX-RS model to be valid:
  • The REST and JAX-RS profiles must be applied to the model
  • A root resource must have a public constructor method
  • Resource methods that have the «SubResourceLocator» stereotype applied must set the return type to the Resource that this SubResourceLocator method points to; the return type cannot be void
  • Resource classes must have at least one method that has an @Path annotation, or a request method designator
  • All application classes must have the same value for the rootPath property

Feedback