Annotation Type Mapping


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented public @interface Mapping
Annotation for mapping Dubbo services to Rest endpoints.

Example usage:

 @Mapping(value = "/example", method = HttpMethods.GET, produces = "application/json")
 String handleExample();
 
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the media types that the mapped handler consumes.
    boolean
    Indicates whether the mapping is enabled.
    Specifies the request headers that must be present for this mapping to be invoked.
    Defines the HTTP methods supported by the mapped handler.
    Specifies the request parameters that must be present for this mapping to be invoked.
    Specifies the path patterns to be mapped.
    Specifies the media types that the mapped handler produces.
    Alias for path().
  • Element Details

    • value

      String[] value
      Alias for path(). The path patterns to be mapped. If not specified, the method or class name is used as the default.
      Default:
      {}
    • path

      String[] path
      Specifies the path patterns to be mapped. If not specified, the method or class name is used as the default.
      Default:
      {}
    • method

      HttpMethods[] method
      Defines the HTTP methods supported by the mapped handler. Supports values like GET, POST, etc.
      Default:
      {}
    • params

      String[] params
      Specifies the request parameters that must be present for this mapping to be invoked. Example: "param1=value1", "param2".
      Default:
      {}
    • headers

      String[] headers
      Specifies the request headers that must be present for this mapping to be invoked. Example: "content-type=application/json".
      Default:
      {}
    • consumes

      String[] consumes
      Specifies the media types that the mapped handler consumes. Example: "application/json", "text/plain".
      Default:
      {}
    • produces

      String[] produces
      Specifies the media types that the mapped handler produces. Example: "application/json", "text/html".
      Default:
      {}
    • enabled

      boolean enabled
      Indicates whether the mapping is enabled. Defaults to true. If set to false, the mapping will be ignored.
      Default:
      true