Interface RestResponse


public interface RestResponse
Minimal framework-independent REST response abstraction.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    body(String body)
    Sets the response body.
    default void
    header(String name, String value)
    Sets a response header.
    void
    status(int statusCode)
    Sets the response status.
  • Method Details

    • status

      void status(int statusCode)
      Sets the response status.
      Parameters:
      statusCode - HTTP status code
    • body

      void body(String body)
      Sets the response body.
      Parameters:
      body - response body
    • header

      default void header(String name, String value)
      Sets a response header.

      Default is a safe no-op so existing implementations keep working even before they opt in. Implementations should override this to actually emit the header.

      Parameters:
      name - header name; non-null, non-blank
      value - header value; non-null