Class CrestHttp


  • public final class CrestHttp
    extends Object

    A CREST HTTP utility class which creates instances of the HttpAdapter to handle CREST HTTP requests.

    Instances must be provided with a ConnectionFactory in order to operate and optionally a HttpContextFactory.

    • Method Detail

      • newHttpHandler

        @Deprecated
        public static org.forgerock.http.Handler newHttpHandler​(ConnectionFactory connectionFactory)
        Deprecated.
        Creates a new JSON resource HTTP Handler with the provided connection factory and no context factory.
        Parameters:
        connectionFactory - The connection factory.
        Returns:
        A CREST HTTP Handler.
      • newHttpHandler

        @Deprecated
        public static org.forgerock.http.Handler newHttpHandler​(ConnectionFactory connectionFactory,
                                                                org.forgerock.services.context.Context parentContext)
        Deprecated.
        Creates a new JSON resource HTTP Handler with the provided connection factory and a context factory which will always return the provided request context.
        Parameters:
        connectionFactory - The connection factory.
        parentContext - The parent request context which should be used as the parent context of each request context.
        Returns:
        A HTTP Handler.
      • newHttpHandler

        @Deprecated
        public static org.forgerock.http.Handler newHttpHandler​(ConnectionFactory connectionFactory,
                                                                HttpContextFactory contextFactory)
        Deprecated.
        Creates a new JSON resource HTTP Handler with the provided connection factory and context factory.
        Parameters:
        connectionFactory - The connection factory.
        contextFactory - The context factory which will be used to obtain the parent context of each request context.
        Returns:
        A HTTP Handler.
      • newHttpHandler

        @Deprecated
        public static org.forgerock.http.Handler newHttpHandler​(CrestApplication application)
        Deprecated.
        Since 25.0.0. Prefer to use newHttpHandler(CrestApplication, Factory) and provide your own factory instead of the default one.
        Creates a new JSON resource HTTP handler with the provided CREST request handler.
        Parameters:
        application - The application.
        Returns:
        The handler
      • newHttpHandler

        public static org.forgerock.http.Handler newHttpHandler​(CrestApplication application,
                                                                Factory<org.forgerock.http.io.Buffer> bufferFactory)
        Creates a new JSON resource HTTP handler with the provided CREST request handler.
        Parameters:
        application - The application.
        bufferFactory - The factory to create buffers to store temporary data.
        Returns:
        The handler
      • newHttpHandler

        public static org.forgerock.http.Handler newHttpHandler​(CrestApplication application,
                                                                HttpContextFactory factory,
                                                                Factory<org.forgerock.http.io.Buffer> bufferFactory)
        Creates a new JSON resource HTTP handler with the provided CREST request handler.
        Parameters:
        application - The application.
        factory - A factory for creating parent HTTP Contexts.
        bufferFactory - The factory to create buffers to store temporary data.
        Returns:
        The handler
      • newHttpHandler

        @Deprecated
        public static org.forgerock.http.Handler newHttpHandler​(CrestApplication application,
                                                                org.forgerock.services.context.Context context)
        Deprecated.
        Since 25.0.0. Prefer to use newHttpHandler(CrestApplication, Context, Factory) and provide your own factory instead of the default one.
        Creates a new JSON resource HTTP handler with the provided CREST request handler.
        Parameters:
        application - The application.
        context - The parent context to use for all contexts.
        Returns:
        The handler
      • newHttpHandler

        public static org.forgerock.http.Handler newHttpHandler​(CrestApplication application,
                                                                org.forgerock.services.context.Context context,
                                                                Factory<org.forgerock.http.io.Buffer> bufferFactory)
        Creates a new JSON resource HTTP handler with the provided CREST request handler.
        Parameters:
        application - The application.
        context - The parent context to use for all contexts.
        bufferFactory - The factory to create buffers to store temporary data.
        Returns:
        The handler
      • newRequestHandler

        public static RequestHandler newRequestHandler​(org.forgerock.http.Handler handler,
                                                       URI uri)
        Creates a new RequestHandler that map back and forth JSON resource objects to CHF objects.
        Parameters:
        handler - HTTP Handler responsible for emitting the HTTP request build from JSON resource Requests.
        uri - base URI used to build the target URI for built HTTP message
        Returns:
        a JSON resource RequestHandler
      • newConnectionFactory

        public static ConnectionFactory newConnectionFactory​(org.forgerock.http.Handler handler,
                                                             URI uri)
        Creates a new ConnectionFactory that map back and forth JSON resource objects to CHF objects.

        Convenience method. Note that ConnectionFactory is going to be removed soon, so you may not need this.

        Parameters:
        handler - HTTP Handler responsible for emitting the HTTP request build from JSON resource Requests.
        uri - base URI used to build the target URI for built HTTP message
        Returns:
        a JSON resource RequestHandler