Module methanol

Class ResponseBuilder<T>

    • Method Detail

      • statusCode

        @CanIgnoreReturnValue
        public ResponseBuilder<T> statusCode​(int statusCode)
      • uri

        @CanIgnoreReturnValue
        public ResponseBuilder<T> uri​(java.net.URI uri)
      • uri

        @CanIgnoreReturnValue
        public ResponseBuilder<T> uri​(java.lang.String uri)
      • version

        @CanIgnoreReturnValue
        public ResponseBuilder<T> version​(java.net.http.HttpClient.Version version)
      • headers

        @CanIgnoreReturnValue
        public ResponseBuilder<T> headers​(java.lang.String... headers)
        Description copied from interface: HeadersAccumulator
        Adds each of the given header name-value pairs. The pairs must be appended to each other in the given array, where each name is followed by a corresponding value.
        Specified by:
        headers in interface HeadersAccumulator<T>
      • setHeader

        @CanIgnoreReturnValue
        public ResponseBuilder<T> setHeader​(java.lang.String name,
                                            java.lang.String value)
        Description copied from interface: HeadersAccumulator
        Sets the header represented by the given name to the given value, overwriting the previous value (if any).
        Specified by:
        setHeader in interface HeadersAccumulator<T>
      • setHeader

        public ResponseBuilder<T> setHeader​(java.lang.String name,
                                            java.util.List<java.lang.String> values)
        Description copied from interface: HeadersAccumulator
        Sets the header represented by the given name to the given values, overwriting the previous value (if any).
        Specified by:
        setHeader in interface HeadersAccumulator<T>
      • setHeaderIfAbsent

        public ResponseBuilder<T> setHeaderIfAbsent​(java.lang.String name,
                                                    java.lang.String value)
        Description copied from interface: HeadersAccumulator
        Sets the header represented by the given name to the given value, only if there was no header with the given name.
        Specified by:
        setHeaderIfAbsent in interface HeadersAccumulator<T>
      • setHeaderIfAbsent

        public ResponseBuilder<T> setHeaderIfAbsent​(java.lang.String name,
                                                    java.util.List<java.lang.String> values)
        Description copied from interface: HeadersAccumulator
        Sets the header represented by the given name to the given values, only if there was no header with the given name.
        Specified by:
        setHeaderIfAbsent in interface HeadersAccumulator<T>
      • removeHeadersIf

        @CanIgnoreReturnValue
        public ResponseBuilder<T> removeHeadersIf​(java.util.function.BiPredicate<java.lang.String,​java.lang.String> filter)
        Description copied from interface: HeadersAccumulator
        Removes all the header name-value pairs matched by the given predicate.
        Specified by:
        removeHeadersIf in interface HeadersAccumulator<T>
      • request

        @CanIgnoreReturnValue
        public ResponseBuilder<T> request​(java.net.http.HttpRequest request)
      • timeRequestSent

        @CanIgnoreReturnValue
        public ResponseBuilder<T> timeRequestSent​(java.time.Instant timeRequestSent)
      • timeResponseReceived

        @CanIgnoreReturnValue
        public ResponseBuilder<T> timeResponseReceived​(java.time.Instant timeResponseReceived)
      • body

        @CanIgnoreReturnValue
        public <U> ResponseBuilder<U> body​(@Nullable U body)
      • sslSession

        @CanIgnoreReturnValue
        public ResponseBuilder<T> sslSession​(@Nullable javax.net.ssl.SSLSession sslSession)
      • previousResponse

        @CanIgnoreReturnValue
        public ResponseBuilder<T> previousResponse​(@Nullable java.net.http.HttpResponse<T> previousResponse)
      • build

        public java.net.http.HttpResponse<T> build()
      • create

        public static <T> ResponseBuilder<T> create()
        Returns a new ResponseBuilder.
      • from

        public static <T> ResponseBuilder<T> from​(java.net.http.HttpResponse<T> response)
        Returns a new ResponseBuilder that copies the given response's state.