Search in sources :

Example 1 with HttpHandler

use of org.glassfish.grizzly.http.server.HttpHandler in project jersey by jersey.

the class NonJaxRsBeanJaxRsInjectionTest method startGrizzlyContainer.

private void startGrizzlyContainer() throws IOException {
    final ResourceConfig firstConfig = ResourceConfig.forApplicationClass(MainApplication.class);
    final ResourceConfig secondConfig = ResourceConfig.forApplicationClass(SecondaryApplication.class);
    httpServer = GrizzlyHttpServerFactory.createHttpServer(MAIN_APP_URI, firstConfig, false);
    final HttpHandler secondHandler = createGrizzlyContainer(secondConfig);
    httpServer.getServerConfiguration().addHttpHandler(secondHandler, SECONDARY_URI);
    httpServer.start();
}
Also used : HttpHandler(org.glassfish.grizzly.http.server.HttpHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 2 with HttpHandler

use of org.glassfish.grizzly.http.server.HttpHandler in project jersey by jersey.

the class CombinedTest method startGrizzlyContainer.

private void startGrizzlyContainer() throws IOException {
    final ResourceConfig cdiConfig = ResourceConfig.forApplicationClass(CdiApplication.class);
    final ResourceConfig hk2Config = ResourceConfig.forApplicationClass(Hk2Application.class);
    cdiServer = GrizzlyHttpServerFactory.createHttpServer(BASE_CDI_URI, cdiConfig, false);
    final HttpHandler hk2Handler = createGrizzlyContainer(hk2Config);
    cdiServer.getServerConfiguration().addHttpHandler(hk2Handler, HK2_URI);
    cdiServer.start();
}
Also used : HttpHandler(org.glassfish.grizzly.http.server.HttpHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 3 with HttpHandler

use of org.glassfish.grizzly.http.server.HttpHandler in project ddf by codice.

the class SecureStubServer method stubsToHandler.

private HttpHandler stubsToHandler() {
    return new HttpHandler() {

        @Override
        public void service(Request request, Response response) throws Exception {
            Call call = Call.fromRequest(request);
            CallsHelper.logCall(call);
            boolean processed = false;
            ListIterator<Stub> iterator = stubs.listIterator(stubs.size());
            while (iterator.hasPrevious()) {
                Stub stub = iterator.previous();
                if (!stub.isApplicable(call)) {
                    continue;
                }
                stub.apply(response);
                processed = true;
                break;
            }
            if (!processed) {
                response.setStatus(HttpStatus.NOT_FOUND_404);
                LOGGER.debug("Request {} hasn't been covered by any of {} stubs.", request.getRequestURI(), stubs.size());
            }
            calls.add(call);
        }
    };
}
Also used : Response(org.glassfish.grizzly.http.server.Response) HttpHandler(org.glassfish.grizzly.http.server.HttpHandler) Call(com.xebialabs.restito.semantics.Call) Request(org.glassfish.grizzly.http.server.Request) Stub(com.xebialabs.restito.semantics.Stub)

Aggregations

HttpHandler (org.glassfish.grizzly.http.server.HttpHandler)3 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)2 Call (com.xebialabs.restito.semantics.Call)1 Stub (com.xebialabs.restito.semantics.Stub)1 Request (org.glassfish.grizzly.http.server.Request)1 Response (org.glassfish.grizzly.http.server.Response)1