Class 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.monitoring.MonitoringHandler monitoringHandler, String userProfilePath, HttpHook httpHook, String urlPattern, io.vertx.core.http.HttpClient selfClient)
      Creates a new instance of a Route.
    • 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.monitoring.MonitoringHandler monitoringHandler,
                     String userProfilePath,
                     HttpHook httpHook,
                     String urlPattern,
                     io.vertx.core.http.HttpClient selfClient)
        Creates a new instance of a Route.
        Parameters:
        vertx - vertx
        storage - storage
        loggingResourceManager - loggingResourceManager
        monitoringHandler - monitoringHandler
        userProfilePath - userProfilePath
        httpHook - httpHook
        urlPattern - - this can be a listener or a normal urlPattern (eg. for a route)
    • Method Detail

      • getRule

        public org.swisspush.gateleen.routing.Rule getRule()
      • forward

        public void forward​(io.vertx.core.http.HttpServerRequest request,
                            io.vertx.core.buffer.Buffer requestBody)
        Handles the request (consumed) and forwards it to the hook specific destination.
        Parameters:
        request - - the original but already consumed request
        requestBody - - saved buffer with the data of body from the original request
      • forward

        public void forward​(io.vertx.core.http.HttpServerRequest request)
        Handles the request and forwards it to the hook specific destination.
        Parameters:
        request - request
      • 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