
org.davidmoten.oa3.codegen.http.service.HttpConnection Maven / Gradle / Ivy
The newest version!
package org.davidmoten.oa3.codegen.http.service;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
import java.util.function.Consumer;
/**
* Expected sequence of calls is (BNF):
*
*
* header()* [outputStream()] [response()] [close()]
*
*/
public interface HttpConnection {
void header(String key, String value);
void setConnectTimeoutMs(long connectTimeoutMs);
void setReadTimeoutMs(long readTimeoutMs);
/**
* When a consumer is defined (when this method is called), this class is
* expected to set the Content-Type and Content-Length fields (and support
* chunking if requested).
*
* @param consumer action to be performed on the OutputStream
* @param contentType Content-Type header value
* @param contentEncoding if present is appended to the Content-Type value
*/
void output(Consumer super OutputStream> consumer, String contentType, Optional contentEncoding,
boolean chunked);
Response response() throws IOException;
void close() throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy