Package org.swisspush.gateleen.hook
Class Route
- java.lang.Object
-
- org.swisspush.gateleen.hook.Route
-
public class Route extends Object
Represents a Route for a specific hook. Each source (eg. listener) has its own Route! The Route forwards a request for a source (eg. listener) to the destination specified by the HttpHook.- Author:
- https://github.com/ljucam [Mario Ljuca]
-
-
Constructor Summary
Constructors Constructor Description Route(io.vertx.core.Vertx vertx, org.swisspush.gateleen.core.storage.ResourceStorage storage, org.swisspush.gateleen.logging.LoggingResourceManager loggingResourceManager, org.swisspush.gateleen.logging.LogAppenderRepository logAppenderRepository, org.swisspush.gateleen.monitoring.MonitoringHandler monitoringHandler, String userProfilePath, HttpHook httpHook, String urlPattern, io.vertx.core.http.HttpClient selfClient, String hookDisplayText)Creates a new instance of a Route.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Closes the http client of the route.voidforward(io.vertx.ext.web.RoutingContext ctx)Handles the request and forwards it to the hook specific destination.voidforward(io.vertx.ext.web.RoutingContext ctx, io.vertx.core.buffer.Buffer requestBody, io.vertx.core.Handler<Void> afterHandler)Handles the request (consumed) and forwards it to the hook specific destination.HttpHookgetHook()Returns the hook associated with this route.StringgetHookDisplayText()org.swisspush.gateleen.routing.RulegetRule()voidsetMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
-
-
Constructor Detail
-
Route
public Route(io.vertx.core.Vertx vertx, org.swisspush.gateleen.core.storage.ResourceStorage storage, org.swisspush.gateleen.logging.LoggingResourceManager loggingResourceManager, org.swisspush.gateleen.logging.LogAppenderRepository logAppenderRepository, @Nullable org.swisspush.gateleen.monitoring.MonitoringHandler monitoringHandler, String userProfilePath, HttpHook httpHook, String urlPattern, io.vertx.core.http.HttpClient selfClient, String hookDisplayText)Creates a new instance of a Route.- Parameters:
vertx- vertxstorage- storageloggingResourceManager- loggingResourceManagermonitoringHandler- monitoringHandleruserProfilePath- userProfilePathhttpHook- httpHookurlPattern- - this can be a listener or a normal urlPattern (eg. for a route)
-
-
Method Detail
-
setMeterRegistry
public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
getRule
public org.swisspush.gateleen.routing.Rule getRule()
-
forward
public void forward(io.vertx.ext.web.RoutingContext ctx, io.vertx.core.buffer.Buffer requestBody, @Nullable io.vertx.core.Handler<Void> afterHandler)Handles the request (consumed) and forwards it to the hook specific destination.- Parameters:
ctx- - the original but already consumed requestrequestBody- - saved buffer with the data of body from the original request
-
forward
public void forward(io.vertx.ext.web.RoutingContext ctx)
Handles the request and forwards it to the hook specific destination.- Parameters:
ctx- request context
-
cleanup
public void cleanup()
Closes the http client of the route.
-
getHook
public HttpHook getHook()
Returns the hook associated with this route.- Returns:
- the hook
-
getHookDisplayText
public String getHookDisplayText()
-
-