java.lang.Object
io.prometheus.metrics.exporter.servlet.javax.HttpExchangeAdapter
All Implemented Interfaces:
io.prometheus.metrics.exporter.common.PrometheusHttpExchange, AutoCloseable

public class HttpExchangeAdapter extends Object implements io.prometheus.metrics.exporter.common.PrometheusHttpExchange
This class is an adapter for HTTP exchanges, implementing the PrometheusHttpExchange interface. It wraps HttpServletRequest and HttpServletResponse objects into Request and Response inner classes.
  • Constructor Details

    • HttpExchangeAdapter

      public HttpExchangeAdapter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Constructs a new HttpExchangeAdapter with the given HttpServletRequest and HttpServletResponse.
      Parameters:
      request - the HttpServletRequest to be adapted
      response - the HttpServletResponse to be adapted
  • Method Details

    • getRequest

      public io.prometheus.metrics.exporter.common.PrometheusHttpRequest getRequest()
      Returns the adapted HttpServletRequest.
      Specified by:
      getRequest in interface io.prometheus.metrics.exporter.common.PrometheusHttpExchange
      Returns:
      the adapted HttpServletRequest
    • getResponse

      public io.prometheus.metrics.exporter.common.PrometheusHttpResponse getResponse()
      Returns the adapted HttpServletResponse.
      Specified by:
      getResponse in interface io.prometheus.metrics.exporter.common.PrometheusHttpExchange
      Returns:
      the adapted HttpServletResponse
    • handleException

      public void handleException(IOException e) throws IOException
      Specified by:
      handleException in interface io.prometheus.metrics.exporter.common.PrometheusHttpExchange
      Throws:
      IOException
    • handleException

      public void handleException(RuntimeException e)
      Specified by:
      handleException in interface io.prometheus.metrics.exporter.common.PrometheusHttpExchange
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface io.prometheus.metrics.exporter.common.PrometheusHttpExchange