Search in sources :

Example 96 with ApplicationHandler

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

the class FilterSetMethodTest method testPostMatchingFilter.

@Test
public void testPostMatchingFilter() throws ExecutionException, InterruptedException {
    ApplicationHandler handler = new ApplicationHandler(new ResourceConfig(Resource.class, PostMatchFilter.class));
    ContainerResponse res = handler.apply(RequestContextBuilder.from("", "/resource/setMethod", "GET").build()).get();
    assertEquals(200, res.getStatus());
}
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 97 with ApplicationHandler

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

the class FilterSetMethodTest method testResourceUri.

@Test
public void testResourceUri() throws ExecutionException, InterruptedException {
    ApplicationHandler handler = new ApplicationHandler(new ResourceConfig(ResourceChangeUri.class, PreMatchChangingUriFilter.class));
    ContainerResponse res = handler.apply(RequestContextBuilder.from("", "/resourceChangeUri/first", "GET").build()).get();
    assertEquals(200, res.getStatus());
    assertEquals("ok", res.getEntity());
}
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 98 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 99 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 100 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)

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