@Test public void testProgrammaticSingletonResourceClass() throws Exception { ResourceConfig rc = new ResourceConfig(); org.glassfish.jersey.server.model.Resource.Builder rb; rb = org.glassfish.jersey.server.model.Resource.builder(); rb.path("singleton").addMethod("GET").handledBy(ProgrammaticSingleton.class); rc.registerResources(rb.build()); rb = org.glassfish.jersey.server.model.Resource.builder(); rb.path("default").addMethod("GET").handledBy(ProgrammaticDefault.class); rc.registerResources(rb.build()); rb = org.glassfish.jersey.server.model.Resource.builder(); rb.path("defaultinstance").addMethod("GET").handledBy(new ProgrammaticDefault()); rc.registerResources(rb.build()); ApplicationHandler ah = new ApplicationHandler(rc); ContainerResponse response = ah.apply(RequestContextBuilder.from("/singleton", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("1", response.getEntity()); response = ah.apply(RequestContextBuilder.from("/singleton", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("2", response.getEntity()); response = ah.apply(RequestContextBuilder.from("/default", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("1", response.getEntity()); response = ah.apply(RequestContextBuilder.from("/default", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("1", response.getEntity()); response = ah.apply(RequestContextBuilder.from("/defaultinstance", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("1", response.getEntity()); response = ah.apply(RequestContextBuilder.from("/defaultinstance", "GET").build()).get(); assertEquals(200, response.getStatus()); assertEquals("2", response.getEntity()); }
public Future<ContainerResponse> apply(final ContainerRequest requestContext) { return apply(requestContext, new NullOutputStream()); }
ApplicationHandler implements ContainerLifecycleListener { public Future<ContainerResponse> apply(final ContainerRequest requestContext) { return apply(requestContext, new NullOutputStream()); } }
ApplicationHandler implements ContainerLifecycleListener { public Future<ContainerResponse> apply(final ContainerRequest requestContext) { return apply(requestContext, new NullOutputStream()); } ApplicationHandler();  ApplicationHandler(final Class<? extends Application> jaxrsApplicationClass);  ApplicationHandler(final Application application);  ApplicationHandler(final Application application, final Binder customBinder);  ApplicationHandler(final Application application, final Binder customBinder, final Object parentManager); }
ApplicationHandler implements ContainerLifecycleListener { public Future<ContainerResponse> apply(final ContainerRequest requestContext) { return apply(requestContext, new NullOutputStream()); } ApplicationHandler();  ApplicationHandler(final Class<? extends Application> jaxrsApplicationClass);  ApplicationHandler(final Application application);  ApplicationHandler(final Application application, final Binder customBinder);  ApplicationHandler(final Application application, final Binder customBinder, final Object parentManager); Future<ContainerResponse> apply(final ContainerRequest requestContext); Future<ContainerResponse> apply(final ContainerRequest request,
                                           final OutputStream outputStream); void handle(final ContainerRequest request); InjectionManager getInjectionManager(); ResourceConfig getConfiguration(); @Override void onStartup(final Container container); @Override void onReload(final Container container); @Override void onShutdown(final Container container); }
ApplicationHandler implements ContainerLifecycleListener { public Future<ContainerResponse> apply(final ContainerRequest requestContext) { return apply(requestContext, new NullOutputStream()); } ApplicationHandler();  ApplicationHandler(final Class<? extends Application> jaxrsApplicationClass);  ApplicationHandler(final Application application);  ApplicationHandler(final Application application, final Binder customBinder);  ApplicationHandler(final Application application, final Binder customBinder, final Object parentManager); Future<ContainerResponse> apply(final ContainerRequest requestContext); Future<ContainerResponse> apply(final ContainerRequest request,
                                           final OutputStream outputStream); void handle(final ContainerRequest request); InjectionManager getInjectionManager(); ResourceConfig getConfiguration(); @Override void onStartup(final Container container); @Override void onReload(final Container container); @Override void onShutdown(final Container container);  }