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();
}
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();
}
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);
}
};
}
Aggregations