接口 ServerResponse.HeadersBuilder<B extends ServerResponse.HeadersBuilder<B>>

    • 方法详细资料

      • headers

        B headers​(Consumer<HttpHeaders> headersConsumer)
        Manipulate this response's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the other HttpHeaders methods.
        参数:
        headersConsumer - a function that consumes the HttpHeaders
        返回:
        this builder
      • cookie

        B cookie​(Cookie cookie)
        Add the given cookie to the response.
        参数:
        cookie - the cookie to add
        返回:
        this builder
      • cookies

        B cookies​(Consumer<MultiValueMap<String,​Cookie>> 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.
        参数:
        cookiesConsumer - a function that consumes the cookies
        返回:
        this builder
      • cacheControl

        B cacheControl​(CacheControl cacheControl)
        Set the caching directives for the resource, as specified by the HTTP 1.1 Cache-Control header.

        A CacheControl instance can be built like CacheControl.maxAge(3600).cachePublic().noTransform().

        参数:
        cacheControl - a builder for cache-related HTTP response headers
        返回:
        this builder
        另请参阅:
        RFC-7234 Section 5.2
      • varyBy

        B varyBy​(String... requestHeaders)
        Configure one or more request header names (e.g. "Accept-Language") to add to the "Vary" response header to inform clients that the response is subject to content negotiation and variances based on the value of the given request headers. The configured request header names are added only if not already present in the response "Vary" header.
        参数:
        requestHeaders - request header names
        返回:
        this builder