Interface GatewayServerResponse

All Superinterfaces:
org.springframework.web.servlet.function.ServerResponse

public interface GatewayServerResponse extends org.springframework.web.servlet.function.ServerResponse
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.web.servlet.function.ServerResponse

    org.springframework.web.servlet.function.ServerResponse.BodyBuilder, org.springframework.web.servlet.function.ServerResponse.Context, org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<B extends org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<B>>, org.springframework.web.servlet.function.ServerResponse.SseBuilder, org.springframework.web.servlet.function.ServerResponse.StreamBuilder
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    Create a builder with a 202 Accepted status.
    static org.springframework.web.servlet.function.ServerResponse
    async(Object asyncResponse)
    Create a (built) response with the given asynchronous response.
    static org.springframework.web.servlet.function.ServerResponse
    async(Object asyncResponse, Duration timeout)
    Create a (built) response with the given asynchronous response.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    Create a builder with a 400 Bad Request status.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    created(URI location)
    Create a builder with a 201 Created status and a location header set to the given URI.
    static org.springframework.web.servlet.function.ServerResponse
    from(org.springframework.web.ErrorResponse response)
    Create a ServerResponse from the given ErrorResponse.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    from(org.springframework.web.servlet.function.ServerResponse other)
    Create a builder with the status code and headers of the given response.
    static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?>
    Create a builder with a 204 No Content status.
    static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?>
    Create a builder with a 404 Not Found status.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    ok()
    Create a builder with the status set to 200 OK.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    Create a builder with a 308 Permanent Redirect status and a location header set to the given URI.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    seeOther(URI location)
    Create a builder with a 303 See Other status and a location header set to the given URI.
    void
    setStatusCode(org.springframework.http.HttpStatusCode statusCode)
     
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    status(int status)
    Create a builder with the given HTTP status.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    status(org.springframework.http.HttpStatusCode status)
    Create a builder with the given HTTP status.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    Create a builder with a 307 Temporary Redirect status and a location header set to the given URI.
    static org.springframework.web.servlet.function.ServerResponse.BodyBuilder
    Create a builder with a 422 Unprocessable Entity status.

    Methods inherited from interface org.springframework.web.servlet.function.ServerResponse

    cookies, headers, statusCode, writeTo
  • Method Details

    • setStatusCode

      void setStatusCode(org.springframework.http.HttpStatusCode statusCode)
    • from

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder from(org.springframework.web.servlet.function.ServerResponse other)
      Create a builder with the status code and headers of the given response.
      Parameters:
      other - the response to copy the status and headers from
      Returns:
      the created builder
    • from

      static org.springframework.web.servlet.function.ServerResponse from(org.springframework.web.ErrorResponse response)
      Create a ServerResponse from the given ErrorResponse.
      Parameters:
      response - the ErrorResponse to initialize from
      Returns:
      the built response
      Since:
      6.0
    • status

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder status(org.springframework.http.HttpStatusCode status)
      Create a builder with the given HTTP status.
      Parameters:
      status - the response status
      Returns:
      the created builder
    • status

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder status(int status)
      Create a builder with the given HTTP status.
      Parameters:
      status - the response status
      Returns:
      the created builder
    • ok

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder ok()
      Create a builder with the status set to 200 OK.
      Returns:
      the created builder
    • created

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder created(URI location)
      Create a builder with a 201 Created status and a location header set to the given URI.
      Parameters:
      location - the location URI
      Returns:
      the created builder
    • accepted

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder accepted()
      Create a builder with a 202 Accepted status.
      Returns:
      the created builder
    • noContent

      static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?> noContent()
      Create a builder with a 204 No Content status.
      Returns:
      the created builder
    • seeOther

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder seeOther(URI location)
      Create a builder with a 303 See Other status and a location header set to the given URI.
      Parameters:
      location - the location URI
      Returns:
      the created builder
    • temporaryRedirect

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder temporaryRedirect(URI location)
      Create a builder with a 307 Temporary Redirect status and a location header set to the given URI.
      Parameters:
      location - the location URI
      Returns:
      the created builder
    • permanentRedirect

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder permanentRedirect(URI location)
      Create a builder with a 308 Permanent Redirect status and a location header set to the given URI.
      Parameters:
      location - the location URI
      Returns:
      the created builder
    • badRequest

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder badRequest()
      Create a builder with a 400 Bad Request status.
      Returns:
      the created builder
    • notFound

      static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?> notFound()
      Create a builder with a 404 Not Found status.
      Returns:
      the created builder
    • unprocessableEntity

      static org.springframework.web.servlet.function.ServerResponse.BodyBuilder unprocessableEntity()
      Create a builder with a 422 Unprocessable Entity status.
      Returns:
      the created builder
    • async

      static org.springframework.web.servlet.function.ServerResponse async(Object asyncResponse)
      Create a (built) response with the given asynchronous response. Parameter asyncResponse can be a CompletableFuture<ServerResponse> or Publisher<ServerResponse> (or any asynchronous producer of a single ServerResponse that can be adapted via the ReactiveAdapterRegistry).

      This method can be used to set the response status code, headers, and body based on an asynchronous result. If only the body is asynchronous, ServerResponse.BodyBuilder.body(Object) can be used instead.

      Parameters:
      asyncResponse - a CompletableFuture<ServerResponse> or Publisher<ServerResponse>
      Returns:
      the asynchronous response
      Since:
      5.3
    • async

      static org.springframework.web.servlet.function.ServerResponse async(Object asyncResponse, Duration timeout)
      Create a (built) response with the given asynchronous response. Parameter asyncResponse can be a CompletableFuture<ServerResponse> or Publisher<ServerResponse> (or any asynchronous producer of a single ServerResponse that can be adapted via the ReactiveAdapterRegistry).

      This method can be used to set the response status code, headers, and body based on an asynchronous result. If only the body is asynchronous, ServerResponse.BodyBuilder.body(Object) can be used instead.

      Parameters:
      asyncResponse - a CompletableFuture<ServerResponse> or Publisher<ServerResponse>
      timeout - maximum time period to wait for before timing out
      Returns:
      the asynchronous response
      Since:
      5.3.2