io.muserver.rest.ApiResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mu-server Show documentation
Show all versions of mu-server Show documentation
A simple but powerful web server framework
package io.muserver.rest;
import java.lang.annotation.*;
/**
* Describes a response code and description for an API method, for documentation purposes.
* Multiple annotations can be added to cover multiple response types.
* @see ApiResponses
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(ApiResponses.class)
public @interface ApiResponse {
/**
* The HTTP status code of the response. This is a String to allow values such as "2XX" to cover all 200-299 codes.
* @return The code
*/
String code();
/**
* A short description of the response.
* CommonMark syntax MAY be used for rich text representation.
* @return The description
*/
String message();
/**
* A list of possible headers provided alongside the response.
*
* @return a list of response headers.
*/
ResponseHeader[] responseHeaders() default {};
/**
* The type of the response body.
* @return The type
*/
Class> response() default Void.class;
/**
* The content type for this code, if different from the default
* @return A content type such as text/plain
*/
String[] contentType() default {};
}