Package org.forgerock.http.grizzly
Class GrizzlySupport
- java.lang.Object
-
- org.forgerock.http.grizzly.GrizzlySupport
-
public final class GrizzlySupport extends Object
Provides the Grizzly HTTP library support to the common HTTP Framework.Simple example usage with OpenIG. It attempts to listen on port 8080 and expects to find an OpenIG config directory under the config-base directory where the example is started. It runs until an exception is thrown or the process is killed.
import org.forgerock.http.HttpApplication; import org.forgerock.http.grizzly.GrizzlySupport; import org.forgerock.openig.http.GatewayEnvironment; import org.forgerock.openig.http.GatewayHttpApplication; import org.glassfish.grizzly.http.server.HttpServer; public class Main { public static void main(String[] args) { // Set this to an appropriate value to enable OpenIG to find its configuration files. System.setProperty(GatewayEnvironment.BASE_SYSTEM_PROPERTY, "config-base"); HttpServer server = HttpServer.createSimpleServer(null, 8080); HttpApplication application = new GatewayHttpApplication(); server.getServerConfiguration().addHttpHandler(GrizzlySupport.newGrizzlyHttpHandler(application)); // Set to true if you want to enable HTTP methods such as Delete having a payload. server.getServerConfiguration().setAllowPayloadForUndefinedHttpMethods(true); try { server.start(); } catch (Exception e) { server.shutdownNow(); } } }
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.glassfish.grizzly.http.server.HttpHandlernewGrizzlyHttpHandler(org.forgerock.http.Handler handler, org.forgerock.util.Factory<org.forgerock.http.io.Buffer> storage)Create a new GrizzlyHttpHandlerfrom the given common HTTP FrameworkHandler.static org.glassfish.grizzly.http.server.HttpHandlernewGrizzlyHttpHandler(org.forgerock.http.Handler handler, org.forgerock.util.Factory<org.forgerock.http.io.Buffer> storage, org.forgerock.http.ApiProducer<io.swagger.models.Swagger> apiProducer)Create a new GrizzlyHttpHandlerfrom the given common HTTP FrameworkHandler.static org.glassfish.grizzly.http.server.HttpHandlernewGrizzlyHttpHandler(org.forgerock.http.HttpApplication httpApplication)Create a new GrizzlyHttpHandlerwrapping the given common HTTP FrameworkHttpApplication.
-
-
-
Method Detail
-
newGrizzlyHttpHandler
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(org.forgerock.http.HttpApplication httpApplication)
Create a new GrizzlyHttpHandlerwrapping the given common HTTP FrameworkHttpApplication. The life-cycle of the providedHttpApplicationis bound to the returned GrizzlyHttpHandler. All the operations performed on the GrizzlyHttpHandlerwill be forwarded to the common HTTP FrameworkHandler- Parameters:
httpApplication- TheHttpApplicationExceptionto wrap.- Returns:
- A Grizzly
HttpHandlerready to be added to anHttpServer
-
newGrizzlyHttpHandler
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(org.forgerock.http.Handler handler, org.forgerock.util.Factory<org.forgerock.http.io.Buffer> storage)Create a new GrizzlyHttpHandlerfrom the given common HTTP FrameworkHandler. All the operations performed on the GrizzlyHttpHandlerwill be forwarded to the common HTTP FrameworkHandler. No API Description will be exposed.- Parameters:
handler- TheHttpHandlerto wrap.storage- TheFactorythat will create temporary storageBuffers to handle the processing of requests. Ifnull, a default buffer factory will be used.- Returns:
- A Grizzly
HttpHandlerready to be added to anHttpServer
-
newGrizzlyHttpHandler
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(org.forgerock.http.Handler handler, org.forgerock.util.Factory<org.forgerock.http.io.Buffer> storage, org.forgerock.http.ApiProducer<io.swagger.models.Swagger> apiProducer)Create a new GrizzlyHttpHandlerfrom the given common HTTP FrameworkHandler. All the operations performed on the GrizzlyHttpHandlerwill be forwarded to the common HTTP FrameworkHandler.- Parameters:
handler- TheHandlerto wrap.storage- TheFactorythat will create temporary storageBuffers to handle the processing of requests. Ifnull, a default buffer factory will be used.apiProducer- TheApiProducerto use to expose an OpenAPI API Description.- Returns:
- A Grizzly
HttpHandlerready to be added to anHttpServer
-
-