Package org.apache.juneau.http
Annotation Interface Response
@Documented
@Target({PARAMETER,TYPE,METHOD})
@Retention(RUNTIME)
@Inherited
public @interface 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:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Optional description for the exposed API.String[]Serialized examples of the body of a response.Header[]headers field of the Swagger Response Object.schema field of the Swagger Response Object.Short, concise summary of the exposed API.
-
Element Details
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
summary
Short, concise summary of the exposed API.Intended as a brief, single-line description suitable for AI/LLM consumption, compact documentation, or any context where brevity matters. See
Schema.summary()for the canonical definition.- Returns:
- The annotation value.
- Since:
- 10.0.0
- Default:
- ""
-
examples
Serialized examples of the body of a response.This is a juneau-bean-swagger-v2 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 juneau-bean-swagger-v2 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 REST Server 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:
- {}
-
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.commons.Schema
-