Class Response.Builder

  • Enclosing class:
    Response

    public static class Response.Builder
    extends Object
    Builder class for creating ResponseContext instances with a fluent API.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • status

        public Response.Builder status​(javax.ws.rs.core.Response.Status status)
        Sets the HTTP status for the response.
        Parameters:
        status - the HTTP status
        Returns:
        this Builder for chaining
      • header

        public Response.Builder header​(String name,
                                       String value)
        Adds a header to the response.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        this Builder for chaining
      • entity

        public Response.Builder entity​(Object entity)
        Sets the entity for the response (serialized to JSON for non-String/File types).
        Parameters:
        entity - the entity object
        Returns:
        this Builder for chaining
      • build

        public io.swagger.oas.inflector.models.ResponseContext build()
        Builds the ResponseContext with the configured status, headers, and entity.
        Returns:
        the constructed ResponseContext