Package org.forgerock.json.resource.http
Class CrestHttp
- java.lang.Object
-
- org.forgerock.json.resource.http.CrestHttp
-
public final class CrestHttp extends Object
A CREST HTTP utility class which creates instances of the
HttpAdapterto handle CREST HTTP requests.Instances must be provided with a
ConnectionFactoryin order to operate and optionally aHttpContextFactory.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ConnectionFactorynewConnectionFactory(Handler handler, URI uri)Creates a newConnectionFactorythat map back and forth JSON resource objects to CHF objects.static HandlernewHttpHandler(ConnectionFactory connectionFactory)Deprecated.UsenewHttpHandler(CrestApplication)instead.static HandlernewHttpHandler(ConnectionFactory connectionFactory, HttpContextFactory contextFactory)Deprecated.UsenewHttpHandler(CrestApplication)instead.static HandlernewHttpHandler(ConnectionFactory connectionFactory, Context parentContext)Deprecated.UsenewHttpHandler(CrestApplication)instead.static HandlernewHttpHandler(CrestApplication application)Deprecated.Since 25.0.0.static HandlernewHttpHandler(CrestApplication application, HttpContextFactory factory)Deprecated.Since 25.0.0.static HandlernewHttpHandler(CrestApplication application, HttpContextFactory factory, Factory<Buffer> bufferFactory)Creates a new JSON resource HTTP handler with the provided CREST request handler.static HandlernewHttpHandler(CrestApplication application, Context context)Deprecated.Since 25.0.0.static HandlernewHttpHandler(CrestApplication application, Context context, Factory<Buffer> bufferFactory)Creates a new JSON resource HTTP handler with the provided CREST request handler.static HandlernewHttpHandler(CrestApplication application, Factory<Buffer> bufferFactory)Creates a new JSON resource HTTP handler with the provided CREST request handler.static HandlernewHttpHandler(RequestHandler handler)Deprecated.UsenewHttpHandler(CrestApplication)instead.static RequestHandlernewRequestHandler(Handler handler, URI uri)Creates a newRequestHandlerthat map back and forth JSON resource objects to CHF objects.
-
-
-
Method Detail
-
newHttpHandler
@Deprecated public static Handler newHttpHandler(ConnectionFactory connectionFactory)
Deprecated.UsenewHttpHandler(CrestApplication)instead.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 Handler newHttpHandler(ConnectionFactory connectionFactory, Context parentContext)
Deprecated.UsenewHttpHandler(CrestApplication)instead.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 Handler newHttpHandler(ConnectionFactory connectionFactory, HttpContextFactory contextFactory)
Deprecated.UsenewHttpHandler(CrestApplication)instead.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 Handler newHttpHandler(RequestHandler handler)
Deprecated.UsenewHttpHandler(CrestApplication)instead.Creates a new JSON resource HTTP handler with the provided CREST request handler.- Parameters:
handler- TheRequestHandler.- Returns:
- A HTTP Handler.
-
newHttpHandler
@Deprecated public static Handler newHttpHandler(CrestApplication application)
Deprecated.Since 25.0.0. Prefer to usenewHttpHandler(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 Handler newHttpHandler(CrestApplication application, Factory<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
@Deprecated public static Handler newHttpHandler(CrestApplication application, HttpContextFactory factory)
Deprecated.Since 25.0.0. Prefer to usenewHttpHandler(CrestApplication, HttpContextFactory, 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.factory- A factory for creating parent HTTP Contexts.- Returns:
- The handler
-
newHttpHandler
public static Handler newHttpHandler(CrestApplication application, HttpContextFactory factory, Factory<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 Handler newHttpHandler(CrestApplication application, Context context)
Deprecated.Since 25.0.0. Prefer to usenewHttpHandler(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 Handler newHttpHandler(CrestApplication application, Context context, Factory<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(Handler handler, URI uri)
Creates a newRequestHandlerthat map back and forth JSON resource objects to CHF objects.- Parameters:
handler- HTTPHandlerresponsible for emitting the HTTP request build from JSON resourceRequests.uri- base URI used to build the target URI for built HTTP message- Returns:
- a JSON resource
RequestHandler
-
newConnectionFactory
public static ConnectionFactory newConnectionFactory(Handler handler, URI uri)
Creates a newConnectionFactorythat 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- HTTPHandlerresponsible for emitting the HTTP request build from JSON resourceRequests.uri- base URI used to build the target URI for built HTTP message- Returns:
- a JSON resource
RequestHandler
-
-