public class HttpMetricFilter extends Object implements org.wisdom.api.interception.Filter, org.wisdom.api.http.Status
| Modifier and Type | Field and Description |
|---|---|
private com.codahale.metrics.Counter |
activeRequests |
private org.osgi.framework.BundleContext |
context |
private Pattern |
interceptionPattern |
private Integer |
interceptionPriority |
private ConcurrentMap<Integer,com.codahale.metrics.Meter> |
metersByStatusCode |
private com.codahale.metrics.Meter |
otherMeter |
private org.osgi.framework.ServiceRegistration<org.wisdom.api.interception.Filter> |
reg |
private com.codahale.metrics.Timer |
requestTimer |
ACCEPTED, BAD_GATEWAY, BAD_REQUEST, CONFLICT, CONTINUE, CREATED, EXPECTATION_FAILED, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GONE, HTTP_VERSION_NOT_SUPPORTED, INTERNAL_SERVER_ERROR, LENGTH_REQUIRED, METHOD_NOT_ALLOWED, MOVED_PERMANENTLY, MULTIPLE_CHOICES, NO_CONTENT, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, OK, PARTIAL_CONTENT, PAYMENT_REQUIRED, PRECONDITION_FAILED, PROXY_AUTHENTICATION_REQUIRED, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, REQUESTED_RANGE_NOT_SATISFIABLE, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING_PROTOCOLS, TEMPORARY_REDIRECT, UNAUTHORIZED, UNSUPPORTED_MEDIA_TYPE, USE_PROXY| Constructor and Description |
|---|
HttpMetricFilter(org.osgi.framework.BundleContext context,
org.wisdom.api.configuration.ApplicationConfiguration configuration,
com.codahale.metrics.MetricRegistry registry)
Creates a new instance of the filter.
|
| Modifier and Type | Method and Description |
|---|---|
org.wisdom.api.http.Result |
call(org.wisdom.api.router.Route route,
org.wisdom.api.interception.RequestContext context)
The interception method.
|
private static Map<Integer,String> |
createMeterNamesByStatusCode() |
private void |
markMeterForStatusCode(org.wisdom.api.http.Result result) |
int |
priority()
Gets the filter priority, determining the position of the filter in the filter chain.
|
void |
start()
Starts the filter.
|
void |
stop()
Stops the filter.
|
Pattern |
uri()
Gets the Regex Pattern used to determine whether the route is handled by the filter or not.
|
private final org.osgi.framework.BundleContext context
private final Pattern interceptionPattern
private final Integer interceptionPriority
private org.osgi.framework.ServiceRegistration<org.wisdom.api.interception.Filter> reg
private ConcurrentMap<Integer,com.codahale.metrics.Meter> metersByStatusCode
private com.codahale.metrics.Meter otherMeter
private com.codahale.metrics.Counter activeRequests
private com.codahale.metrics.Timer requestTimer
public HttpMetricFilter(org.osgi.framework.BundleContext context,
org.wisdom.api.configuration.ApplicationConfiguration configuration,
com.codahale.metrics.MetricRegistry registry)
context - the bundle contextconfiguration - the application configurationregistry - the metric registrypublic void start()
public void stop()
public org.wisdom.api.http.Result call(org.wisdom.api.router.Route route,
org.wisdom.api.interception.RequestContext context)
throws Exception
RequestContext.proceed()
to call the next interceptor. Without this call it cuts the chain.call in interface org.wisdom.api.interception.Filterroute - the routecontext - the filter contextException - if anything bad happenprivate void markMeterForStatusCode(org.wisdom.api.http.Result result)
public Pattern uri()
uri in interface org.wisdom.api.interception.Filterpublic int priority()
priority in interface org.wisdom.api.interception.FilterCopyright © 2013–2015 Wisdom Framework. All rights reserved.