Class Router

  • All Implemented Interfaces:
    RequestHandler

    public final class Router
    extends Object
    implements RequestHandler
    Provides routing on LDAP requests based on Dns.

    A request is directed to one reactive handler, or multiple handler in case of subordinate searches. Actually, in the case of the router, reactive handlers are backends.

    The provided context is expected to contain a RequestContext and a ClientContext.

    • Method Detail

      • newRouter

        public static RequestHandler newRouter​(CoreConfigManager coreConfigManager,
                                               BackendConfigManager backendConfigManager)
        Creates a new router.
        Parameters:
        coreConfigManager - The manager which has the knowledge of core configuration attributes of the Directory Server.
        backendConfigManager - The manager which has the knowledge of the association between Dns and backends.
        Returns:
        a router, as a reactive handler
      • handle

        public Flowable<Response> handle​(org.forgerock.services.context.Context context,
                                         Request request)
                                  throws Exception
        Description copied from interface: RequestHandler
        Returns a Flowable representing the asynchronous Response of the given request.

        Successful responses (@see ResultCode.isExceptional() must be provided to the subscriber through the Subscriber.onNext(Object) method. All erroneous responses (e.g: no such object) must be published to the subscriber through the Subscriber.onError(Throwable) method.

        Specified by:
        handle in interface RequestHandler
        Parameters:
        context - The request context.
        request - The request.
        Returns:
        A Flowable of zero or several Response to be returned to the caller.
        Throws:
        Exception - If an error occurred during the processing of the request.