Class HttpExchangeAdapter
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis inner class adapts a HttpServletRequest to a PrometheusHttpRequest.static classThis inner class adapts a HttpServletResponse to a PrometheusHttpResponse. -
Constructor Summary
ConstructorsConstructorDescriptionHttpExchangeAdapter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Constructs a new HttpExchangeAdapter with the given HttpServletRequest and HttpServletResponse. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()io.prometheus.metrics.exporter.common.PrometheusHttpRequestReturns the adapted HttpServletRequest.io.prometheus.metrics.exporter.common.PrometheusHttpResponseReturns the adapted HttpServletResponse.voidvoid
-
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 adaptedresponse- the HttpServletResponse to be adapted
-
-
Method Details
-
getRequest
public io.prometheus.metrics.exporter.common.PrometheusHttpRequest getRequest()Returns the adapted HttpServletRequest.- Specified by:
getRequestin interfaceio.prometheus.metrics.exporter.common.PrometheusHttpExchange- Returns:
- the adapted HttpServletRequest
-
getResponse
public io.prometheus.metrics.exporter.common.PrometheusHttpResponse getResponse()Returns the adapted HttpServletResponse.- Specified by:
getResponsein interfaceio.prometheus.metrics.exporter.common.PrometheusHttpExchange- Returns:
- the adapted HttpServletResponse
-
handleException
- Specified by:
handleExceptionin interfaceio.prometheus.metrics.exporter.common.PrometheusHttpExchange- Throws:
IOException
-
handleException
- Specified by:
handleExceptionin interfaceio.prometheus.metrics.exporter.common.PrometheusHttpExchange
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.prometheus.metrics.exporter.common.PrometheusHttpExchange
-