Interface HttpRequest

    • Method Detail

      • isWebSocket

        boolean isWebSocket()
        Indicates if that request is a websocket request. A websocket request must respond to the following criteria:
        • Has a Connection: Upgrade header
        • Has a Upgrade: websocket header
        • Is a GET request
        • Is an HTTP 1.0 or HTTP 1.1 request
        Returns:
        true is the request is a websocket, false otherwise.
      • webSocket

        WebSocket webSocket()
        Returns the underlying websocket associated to this request or null if the current request is not a websocket request.
        Returns:
        the underlying websocket associated to this request.
        See Also:
        isWebSocket()
      • body

        io.reactivex.rxjava3.core.Maybe<Buffer> body()
        Get the current body request as a Maybe. By getting the body as a Maybe, the current body chunks will be merged together to reconstruct the entire body in provide it in the form of a single Buffer This is useful when the entire body is required to apply some transformation or any manipulation. WARN: beware that the entire body content will be loaded in memory. You should not keep a direct reference on the body chunks as they could be overridden by others at anytime.
        Returns:
        a Maybe observable containing the current entire body request or empty if request body as not been set yet.
        See Also:
        bodyOrEmpty()
      • bodyOrEmpty

        io.reactivex.rxjava3.core.Single<Buffer> bodyOrEmpty()
        Same as body() but returns a Single of Buffer instead. If no body request as been set yet, it returns a Single with an empty Buffer. It is a convenient way that avoid checking if the body is set or not prior to manipulate it.
        Returns:
        a Single observable containing the current entire body request or empty an {@link Buffer) if request body as not been set yet.
        See Also:
        body()
      • body

        void body​(Buffer buffer)
        Set the current body request as a Buffer. This is useful when you want to replace the current body request with a specific content that doesn't come from a reactive chain, ex: request.body(Buffer.buffer("My custom content"); WARN:
        • replacing the request body will NOT "drain" the previous request that was in place.
        • You MUST ensure to consume the previous body by yourself when using it.
        • You SHOULD consider using onBody(MaybeTransformer) to change the body during the chain execution.
        See Also:
        onBody(MaybeTransformer), chunks(Flowable)
      • onBody

        io.reactivex.rxjava3.core.Completable onBody​(io.reactivex.rxjava3.core.MaybeTransformer<Buffer,​Buffer> onBody)
        Applies a transformation on the complete body given as a single Buffer. Ex: request.onBody(body -> body.map(buffer ->Buffer.buffer(buffer.toString().toUpperCase()))); IMPORTANT: applying a transformation on the body content loads the whole body in memory. It's up to the consumer to make sure it is safe to do that without consuming too much memory.
        Parameters:
        onBody - the transformation that will be applied on the body.
        Returns:
        a Completable that completes once the body transformation has occurred.
      • chunks

        io.reactivex.rxjava3.core.Flowable<Buffer> chunks()
        Get the current request body chunks as Flowable of Buffer. This is useful when you want to manipulate the entire body without having to load it in memory. WARN: you should not keep a direct reference on the body chunks as they could be overridden by others at anytime.
        Returns:
        a Flowable containing the current body request chunks.
      • chunks

        void chunks​(io.reactivex.rxjava3.core.Flowable<Buffer> chunks)
        Set the current request body chunks from a Flowable of Buffer. This is useful to directly pump the upstream chunks to the downstream without having to load all the chunks in memory. WARN:
        • replacing the request chunks will NOT "drain" the previous request that was in place.
        • You MUST ensure to consume the previous chunks by yourself when using it.
        • You SHOULD consider using onChunks(FlowableTransformer) to change the chunks during the chain execution.
        Parameters:
        chunks - the Flowable of chunks representing the request body that will be pushed to the upstream.
        See Also:
        body()
      • onChunks

        io.reactivex.rxjava3.core.Completable onChunks​(io.reactivex.rxjava3.core.FlowableTransformer<Buffer,​Buffer> onChunks)
        Applies a transformation on each body chunks and completes when all the chunks have been processed. Ex: request.onChunks(chunks -> chunks.map(buffer -> Buffer.buffer(buffer.toString().toUpperCase()))); IMPORTANT: applying a transformation on the body chunks loads the whole body in memory. It's up to the consumer to make sure it is safe to do that without consuming too much memory. IMPORTANT: applying a transformation on chunks completes when all chunks have been transformed. If used in a policy chain, it means that the next policy will start once all chunks have been transformed
        Parameters:
        onChunks - the transformer that will be applied.
        Returns:
        a Completable that completes once the body transformation has occurred on all the chunks.