All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.http2.StreamedHttpMessage Maven / Gradle / Ivy

There is a newer version: 0.17.11
Show newest version
/*
 * Copyright 2015 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.twitter.http2;

import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpMessage;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.util.concurrent.Future;

/**
 * An {@link HttpMessage} that adds support for streaming content using {@linkplain Pipe pipes}.
 * @see Pipe
 */
public interface StreamedHttpMessage extends HttpMessage {

    /**
     * Gets the pipe for sending the message body as {@linkplain HttpContent} objects.
     * A {@linkplain LastHttpContent last http content} will indicate the end of the body.
     *
     * @return the message body pipe.
     * @see RFC 2616, 3.6.1 Chunked Transfer Coding
     * @see RFC 2616, 4.3 Message Body
     */
    Pipe getContent();

    /**
     * Adds content to the pipe. This returns a future for determining whether the message was received.
     * If the chunk is the last chunk then the pipe will be closed.
     * 

* An {@link LastHttpContent} can be used for the trailer part of a chunked-encoded request.

*

* This method is preferable to {@code getContent().send()} because it does additional checks.

* * @param content the content to send * @return a future indicating when the message was received. */ Future addContent(HttpContent content); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy