Search in sources :

Example 91 with ApplicationHandler

use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.

the class JettyHttpContainer method reload.

@Override
public void reload(final ResourceConfig configuration) {
    appHandler.onShutdown(this);
    appHandler = new ApplicationHandler(configuration.register(new JettyBinder()));
    appHandler.onReload(this);
    appHandler.onStartup(this);
    cacheConfigSetStatusOverSendError();
}
Also used : ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler)

Example 92 with ApplicationHandler

use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.

the class NettyHttpContainer method reload.

@Override
public void reload(ResourceConfig configuration) {
    appHandler.onShutdown(this);
    appHandler = new ApplicationHandler(configuration);
    appHandler.onReload(this);
    appHandler.onStartup(this);
}
Also used : ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler)

Example 93 with ApplicationHandler

use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.

the class ContextBasedInjectionTest method setupApplication.

@Before
public void setupApplication() {
    ResourceConfig rc = new ResourceConfig();
    Resource.Builder rb;
    rb = Resource.builder("a/b/c");
    rb.addMethod("GET").handledBy(new AsyncInflector("A-B-C"));
    rc.registerResources(rb.build());
    rb = Resource.builder("a/b/d");
    rb.addMethod("GET").handledBy(new AsyncInflector("A-B-D"));
    rc.registerResources(rb.build());
    app = new ApplicationHandler(rc);
}
Also used : Resource(org.glassfish.jersey.server.model.Resource) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) Before(org.junit.Before)

Example 94 with ApplicationHandler

use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.

the class LayeredFiltersTest method testResourceSubresourceMethodMultiple.

@Test
public void testResourceSubresourceMethodMultiple() throws ExecutionException, InterruptedException {
    final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithMethodMultiple.class).register(FilterOne.class).register(FilterTwo.class);
    final ApplicationHandler application = new ApplicationHandler(resourceConfig);
    final ContainerResponse response = application.apply(RequestContextBuilder.from("/submethod", "GET").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("onetwo", response.getEntity());
    List<Object> xTest = response.getHeaders().get("X-TEST");
    assertEquals(2, xTest.size());
    assertEquals("two", xTest.get(0));
    assertEquals("one", xTest.get(1));
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) Test(org.junit.Test)

Example 95 with ApplicationHandler

use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.

the class BackgroundSchedulerProviderTest method testCustomRuntimeThreadProviderSupport.

@Test
public void testCustomRuntimeThreadProviderSupport() throws ExecutionException, InterruptedException {
    ApplicationHandler ah = createApplication(CustomThreadProvider.class, TestResource.class);
    final ContainerResponse response = ah.apply(RequestContextBuilder.from("/executors-test", "GET").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("Some executor test assertions failed.", 11, response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) Test(org.junit.Test)

Aggregations

ApplicationHandler (org.glassfish.jersey.server.ApplicationHandler)162 Test (org.junit.Test)142 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)104 ContainerResponse (org.glassfish.jersey.server.ContainerResponse)99 ApplicationInfoListener (org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener)17 MonitoringEventListener (org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener)17 MBeanExposer (org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer)17 ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)12 Response (javax.ws.rs.core.Response)10 MediaType (javax.ws.rs.core.MediaType)8 ContainerRequest (org.glassfish.jersey.server.ContainerRequest)7 MonitoringFeature (org.glassfish.jersey.server.internal.monitoring.MonitoringFeature)6 Resource (org.glassfish.jersey.server.model.Resource)6 ContainerResponseFilter (javax.ws.rs.container.ContainerResponseFilter)5 ArrayList (java.util.ArrayList)4 Ignore (org.junit.Ignore)4 IOException (java.io.IOException)3 ContainerRequestFilter (javax.ws.rs.container.ContainerRequestFilter)3 Inflector (org.glassfish.jersey.process.Inflector)3 Before (org.junit.Before)3