Package org.glassfish.jersey.server

Examples of org.glassfish.jersey.server.ApplicationHandler


        assertEquals("root-get", response.getEntity());
    }

    @Test
    public void testChildResource() throws ExecutionException, InterruptedException {
        ApplicationHandler applicationHandler = createApplication();
        final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/root/child",
                "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("sub-get", response.getEntity());
    }
View Full Code Here


        assertEquals("sub-get", response.getEntity());
    }

    @Test
    public void testAnotherChildResource() throws ExecutionException, InterruptedException {
        ApplicationHandler applicationHandler = createApplication();
        final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/root/another-child",
                "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("another-child-get", response.getEntity());
    }
View Full Code Here


        Resource resource = rootBuilder.build();
        ResourceConfig resourceConfig = new ResourceConfig().registerResources(resource);

        return new ApplicationHandler(resourceConfig);
    }
View Full Code Here

                UniqueResource.class,

                TestDisableValidationFailOnErrorResource.class // we should still be able to invoke a GET on this one.
        );
        rc.property(ServerProperties.RESOURCE_VALIDATION_IGNORE_ERRORS, true);
        ApplicationHandler ah = new ApplicationHandler(rc);

        final ContainerRequest request = RequestContextBuilder.from("/test-disable-validation-fail-on-error", "GET").build();
        ContainerResponse response = ah.apply(request).get();

        assertEquals(200, response.getStatus());
        assertEquals("PASSED", response.getEntity());
    }
View Full Code Here

    }


    @Test
    public void testInfoGet() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-info", response.getEntity());
        assertResponseHeaders(response, "ResourceTestingInfo", "getInfo");
    }
View Full Code Here

        assertResponseHeaders(response, "ResourceTestingInfo", "getInfo");
    }

    @Test
    public void testInfoGetChild() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info/child", "GET").build()).get();
        assertEquals(200, response.getStatus());
        assertEquals("get-info-child", response.getEntity());
        assertResponseHeaders(response, "ResourceTestingInfo", "getChildInfo");
    }
View Full Code Here

        assertResponseHeaders(response, "ResourceTestingInfo", "getChildInfo");
    }

    @Test
    public void test404() throws ExecutionException, InterruptedException {
        ApplicationHandler handler = getApplication();
        final ContainerResponse response = handler.apply(RequestContextBuilder.from("/NOT_FOUND", "GET").build()).get();
        assertEquals(404, response.getStatus());
        assertResponseHeaders(response, "<null>", "<null>");
    }
View Full Code Here

* @author Marek Potociar (marek.potociar at oracle.com)
*/
public class ResourcePathOverrideTest {

    private ApplicationHandler createApplication(ResourceConfig resourceConfig) {
        return new ApplicationHandler(resourceConfig);
    }
View Full Code Here

                });

        final Resource resource = resourceBuilder.build();
        resourceConfig.registerResources(resource);

        ApplicationHandler app = createApplication(resourceConfig);

        ContainerRequest request;
        request = RequestContextBuilder.from("/hello", "GET").build();
        assertEquals("Hello!", app.apply(request).get().getEntity());

        request = RequestContextBuilder.from("/hello2", "GET").build();
        assertEquals("Hello!", app.apply(request).get().getEntity());

        request = RequestContextBuilder.from("/hello2/world", "GET").build();
        final ContainerResponse response = app.apply(request).get();
        assertEquals(200, response.getStatus());
        assertEquals("Hello World!", response.getEntity());
    }
View Full Code Here

public class InnerClassWithGenericTypeTest {

    ApplicationHandler app;

    private ApplicationHandler createApplication(Class<?>... classes) {
        return new ApplicationHandler(new ResourceConfig(classes));
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.ApplicationHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.