Annotation Type RemoteOp


Annotation applied to Java methods on REST proxy interface classes.

Note that this annotation is optional if you do not need to override any of the values.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Defines the HTTP method to use for REST calls.
    REST service path.
    The value the remote method returns.
    REST method name and path.
  • Element Details

    • path

      REST service path.

      If you do not specify a path, then the path is inferred from the Java method name.

      Example:

      @RemotePost public void postPet(...);

      Note that you can also use value() to specify the method name and path in shortened form.

      • An absolute URL.
      • A relative URL interpreted as relative to the root URL defined on the RestClient and/or Remote.path().
      • No path.
      Returns:
      The annotation value.
      Default:
      ""
    • method

      Defines the HTTP method to use for REST calls.

      If not specified, then the method is inferred from the Java method name.

      Example:

      @RemotePost public void postPet(...);


      If the method cannot be inferred, then the default is "GET".

      Note that you can also use value() to specify the method name and path in shortened form.

      Returns:
      The annotation value.
      Default:
      ""
    • returns

      The value the remote method returns.
      • RemoteReturn.BODY (default) - The body of the HTTP response converted to a POJO.
        The return type on the Java method can be any of the following:
        • void - Don't parse any response. Note that the method will still throw an exception if an error HTTP status is returned.
        • Any parsable POJO - The body of the response will be converted to the POJO using the parser defined on the RestClient.
        • Any POJO annotated with the @Response annotation. This allows for response beans to be used which also allows for OpenAPI-based parsing and validation.
        • HttpResponse - Returns the raw HttpResponse returned by the inner HttpClient.
        • Reader - Returns access to the raw reader of the response.
        • InputStream - Returns access to the raw input stream of the response.
      • RemoteReturn.STATUS - The HTTP status code on the response.
        The return type on the Java method can be any of the following:
        • int/Integer - The HTTP response code.
        • boolean/Boolean - true if the response code is <400
      Returns:
      The annotation value.
      Default:
      BODY
    • value

      REST method name and path.

      Can be used to provide a shortened combined form for the method() and path() values.

      The following examples are considered equivalent.

      // Normal form @RemoteOp(method=PUT, path="/{propertyName}") // Shortened form @RemoteOp("PUT /{propertyName}")

      Notes:
      • The path portion is optional.
      Returns:
      The annotation value.
      Default:
      ""