org.springframework.web.reactive.function.server

Interface RenderingResponse.Builder

  • Enclosing interface:
    RenderingResponse


    public static interface RenderingResponse.Builder
    Defines a builder for RenderingResponse.
    • Method Detail

      • modelAttribute

        RenderingResponse.Builder modelAttribute(java.lang.Object attribute)
        Add the supplied attribute to the model using a generated name.

        Note: Empty Collections are not added to the model when using this method because we cannot correctly determine the true convention name. View code should check for null rather than for empty collections.

        Parameters:
        attribute - the model attribute value (never null)
      • modelAttribute

        RenderingResponse.Builder modelAttribute(java.lang.String name,
                                                 @Nullable
                                                 java.lang.Object value)
        Add the supplied attribute value under the supplied name.
        Parameters:
        name - the name of the model attribute (never null)
        value - the model attribute value (can be null)
      • modelAttributes

        RenderingResponse.Builder modelAttributes(java.util.Collection<?> attributes)
        Copy all attributes in the supplied Collection into the model, using attribute name generation for each element.
        See Also:
        modelAttribute(Object)
      • header

        RenderingResponse.Builder header(java.lang.String headerName,
                                         java.lang.String... headerValues)
        Add the given header value(s) under the given name.
        Parameters:
        headerName - the header name
        headerValues - the header value(s)
        Returns:
        this builder
        See Also:
        HttpHeaders.add(String, String)
      • status

        RenderingResponse.Builder status(int status)
        Set the HTTP status.
        Parameters:
        status - the response status
        Returns:
        this builder
        Since:
        5.0.3
      • cookies

        RenderingResponse.Builder cookies(java.util.function.Consumer<MultiValueMap<java.lang.String,ResponseCookie>> cookiesConsumer)
        Manipulate this response's cookies with the given consumer. The cookies provided to the consumer are "live", so that the consumer can be used to overwrite existing cookies, remove cookies, or use any of the other MultiValueMap methods.
        Parameters:
        cookiesConsumer - a function that consumes the cookies
        Returns:
        this builder
      • build

        reactor.core.publisher.Mono<RenderingResponse> build()
        Build the response.
        Returns:
        the built response