public final class GrizzlySupport extends Object
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();
}
}
}
Modifier and Type | Method and Description |
---|---|
static org.glassfish.grizzly.http.server.HttpHandler |
newGrizzlyHttpHandler(Handler handler,
Factory<Buffer> storage)
Create a new Grizzly
HttpHandler from the given common HTTP Framework Handler . |
static org.glassfish.grizzly.http.server.HttpHandler |
newGrizzlyHttpHandler(Handler handler,
Factory<Buffer> storage,
ApiProducer<io.swagger.models.Swagger> apiProducer)
Create a new Grizzly
HttpHandler from the given common HTTP Framework Handler . |
static org.glassfish.grizzly.http.server.HttpHandler |
newGrizzlyHttpHandler(HttpApplication httpApplication)
Create a new Grizzly
HttpHandler wrapping the given common HTTP Framework HttpApplication . |
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(HttpApplication httpApplication)
HttpHandler
wrapping the given common HTTP Framework HttpApplication
. The
life-cycle of the provided HttpApplication
is bound to the returned Grizzly HttpHandler
. All the
operations performed on the Grizzly HttpHandler
will be forwarded to the common HTTP Framework
Handler
httpApplication
- The HttpApplicationException
to wrap.HttpHandler
ready to be added to an HttpServer
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(Handler handler, Factory<Buffer> storage)
public static org.glassfish.grizzly.http.server.HttpHandler newGrizzlyHttpHandler(Handler handler, Factory<Buffer> storage, ApiProducer<io.swagger.models.Swagger> apiProducer)
HttpHandler
from the given common HTTP Framework Handler
. All the operations
performed on the Grizzly HttpHandler
will be forwarded to the common HTTP Framework Handler
.handler
- The Handler
to wrap.storage
- The Factory
that will create temporary storage Buffer
s to handle the processing of
requests. If null
, a default buffer factory will be used.apiProducer
- The ApiProducer
to use to expose an OpenAPI API Description.HttpHandler
ready to be added to an HttpServer
Copyright © 2025 Open Identity Platform Community. All rights reserved.