Annotation Type Response


REST response annotation.

Identifies an interface to use to interact with HTTP parts of an HTTP response through a bean.

Can be used in the following locations:

  • Exception classes thrown from server-side @RestOp-annotated methods.
  • Return type classes of server-side @RestOp-annotated methods.
  • Arguments and argument-types of server-side @RestOp-annotated methods.
  • Return type classes of server-side @RemoteOp-annotated methods.
  • Client-side @RemoteOp-annotated methods.
  • Return type interfaces of client-side @RemoteOp-annotated methods.
See Also:
  • Element Details

    • examples

      Serialized examples of the body of a response.

      This is a Swagger object whose keys are media types and values are string representations of that value.

      // A JSON representation of a PetCreate object. @Response( examples={ "'application/json':'{name:\\'Doggie\\',species:\\'Dog\\'}',", "'text/uon':'(name:Doggie,species=Dog)'" } )

      Used for:
      • Server-side generated Swagger documentation.
      Notes:
      • The format is a Swagger object with string keys (media type) and string values (example for that media type) .
      • The leading/trailing { } characters are optional.
      • Multiple lines are concatenated with newlines so that you can format the value to be readable:
      • Supports SVL Variables (e.g. "$L{my.localized.variable}") for the swagger generator.
      • Resolution of variables is delayed until request time and occurs before parsing.
        This allows you to, for example, pull in a JSON construct from a properties file based on the locale of the HTTP request.
      Returns:
      The annotation value.
      Default:
      {}
    • headers

      headers field of the Swagger Response Object.
      Used for:
      • Server-side generated Swagger documentation.
      Returns:
      The annotation value.
      Default:
      {}
    • on

      Dynamically apply this annotation to the specified classes.
      See Also:
      Returns:
      The annotation value.
      Default:
      {}
    • onClass

      Dynamically apply this annotation to the specified classes.

      Identical to on() except allows you to specify class objects instead of a strings.

      See Also:
      Returns:
      The annotation value.
      Default:
      {}
    • parser

      Specifies the HttpPartParser class used for parsing strings to values.

      Overrides for this part the part parser defined on the REST resource which by default is OpenApiParser.

      Returns:
      The annotation value.
      Default:
      org.apache.juneau.httppart.HttpPartParser.Void.class
    • schema

      schema field of the Swagger Response Object.
      Used for:
      • Server-side schema-based serializing and serializing validation.
      • Server-side generated Swagger documentation.
      Returns:
      The annotation value.
      Default:
      @org.apache.juneau.annotation.Schema
    • serializer

      Specifies the HttpPartSerializer class used for serializing values to strings.

      Overrides for this part the part serializer defined on the REST resource which by default is OpenApiSerializer.

      Returns:
      The annotation value.
      Default:
      org.apache.juneau.httppart.HttpPartSerializer.Void.class