Annotation Interface Resource


@Retention(RUNTIME) @Target(METHOD) public @interface Resource
Annotates a business method of a CDI bean as an exposed resource.

The result of a "resource read" operation is always represented as a ResourceResponse. However, the annotated method can also return other types that are converted according to the following rules.

  • If the method returns an implementation of ResourceContents then the reponse contains the single contents object.
  • If the method returns a List of ResourceContents implementations then the reponse contains the list of contents objects.
  • The method may return a Uni that wraps any of the type mentioned above.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    "The URI of this resource."
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    "A description of what this resource represents."
    "The MIME type of this resource, if known."
    "A human-readable name for this resource."
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant value for name() indicating that the annotated element's name should be used as-is.
  • Field Details

    • ELEMENT_NAME

      static final String ELEMENT_NAME
      Constant value for name() indicating that the annotated element's name should be used as-is.
      See Also:
  • Element Details

    • uri

      String uri
      "The URI of this resource."
    • name

      String name
      "A human-readable name for this resource."
      Default:
      "<<element name>>"
    • description

      String description
      "A description of what this resource represents."
      Default:
      ""
    • mimeType

      String mimeType
      "The MIME type of this resource, if known."
      Default:
      ""