001package io.prometheus.metrics.exporter.common; 002 003import io.prometheus.metrics.annotations.StableApi; 004import java.io.IOException; 005import java.io.OutputStream; 006 007@StableApi 008public interface PrometheusHttpResponse { 009 010 /** See {@code jakarta.servlet.http.HttpServletResponse.setHeader(String, String)} */ 011 void setHeader(String name, String value); 012 013 /** 014 * This is equivalent to calling {@link 015 * com.sun.net.httpserver.HttpExchange#sendResponseHeaders(int, long)} followed by {@link 016 * com.sun.net.httpserver.HttpExchange#getResponseBody()}. 017 */ 018 OutputStream sendHeadersAndGetBody(int statusCode, int contentLength) throws IOException; 019}