Package org.glassfish.jersey.server

Examples of org.glassfish.jersey.server.ApplicationHandler


    }

    @Override
    public void reload(final ResourceConfig configuration) {
        this.containerListener.onShutdown(this);
        appHandler = new ApplicationHandler(configuration, new GrizzlyBinder());
        this.containerListener = ConfigHelper.getContainerLifecycleListener(appHandler);
        containerListener.onReload(this);
        containerListener.onStartup(this);
        cacheConfigSetStatusOverSendError();
    }
View Full Code Here


    @Override
    public void done() {
    }

    private ApplicationContext createSpringContext() {
        ApplicationHandler applicationHandler = locator.getService(ApplicationHandler.class);
        ApplicationContext springContext = (ApplicationContext) applicationHandler.getConfiguration().getProperty(PARAM_SPRING_CONTEXT);
        if (springContext == null) {
            String contextConfigLocation = (String) applicationHandler.getConfiguration().getProperty(PARAM_CONTEXT_CONFIG_LOCATION);
            springContext = createXmlSpringConfiguration(contextConfigLocation);
        }
        return springContext;
    }
View Full Code Here

     * Create new lightweight Java SE HTTP server container.
     *
     * @param application JAX-RS / Jersey application to be deployed on the container.
     */
    JdkHttpHandlerContainer(final Application application) {
        this.appHandler = new ApplicationHandler(application);
        this.containerListener = ConfigHelper.getContainerLifecycleListener(appHandler);
    }
View Full Code Here

     * Create new lightweight Java SE HTTP server container.
     *
     * @param application JAX-RS / Jersey application to be deployed on the container.
     */
    JdkHttpHandlerContainer(final Application application, final ServiceLocator parentLocator) {
        this.appHandler = new ApplicationHandler(application, null, parentLocator);
        this.containerListener = ConfigHelper.getContainerLifecycleListener(appHandler);
    }
View Full Code Here

    }

    @Override
    public void reload(final ResourceConfig configuration) {
        containerListener.onShutdown(this);
        appHandler = new ApplicationHandler(configuration);
        containerListener = ConfigHelper.getContainerLifecycleListener(appHandler);
        containerListener.onReload(this);
        containerListener.onStartup(this);
    }
View Full Code Here

    private static class ServiceLocatorShutdownListener extends AbstractContainerLifecycleListener {

        @Override
        public void onShutdown(final Container container) {
            final ApplicationHandler handler = container.getApplicationHandler();
            final ServiceLocator locator = handler.getServiceLocator();

            // Call @PreDestroy method on Application.
            locator.preDestroy(getWrappedApplication(handler.getConfiguration()));
            // Shutdown ServiceLocator.
            Injections.shutdownLocator(locator);
        }
View Full Code Here

public class RuntimeExecutorsBinderTest {

    private ApplicationHandler createApplication(Class<?>... classes) {
        final ResourceConfig resourceConfig = new ResourceConfig(classes);

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

        }
    }

    @Test
    public void testCustomRuntimeThreadProviderSupport() throws ExecutionException, InterruptedException {
        ApplicationHandler ah = createApplication(CustomThreadProvider.class, ExecutorsTestResource.class);

        final ContainerResponse response = ah.apply(RequestContextBuilder.from("/executors-test", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("Some executor test assertions failed.", 111, response.getEntity());
    }
View Full Code Here

    @Test
    public void testWithInstance() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(Resource.class)
                .register(UriModifyFilter.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/a/b/c", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("/a/b?filter=c", response.getEntity());
    }
View Full Code Here

    @Test
    @Ignore("JERSEY-2414 - not yet implemented")
    public void testResourceMethod() throws ExecutionException, InterruptedException {
        final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocator.class)
                .register(FilterOne.class).register(FilterTwo.class);
        final ApplicationHandler application = new ApplicationHandler(resourceConfig);
        final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub", "GET").build()).get();

        assertEquals(200, response.getStatus());
        assertEquals("onetwo", response.getEntity());
        List<Object> xTest = response.getHeaders().get("X-TEST");
        assertEquals(2, xTest.size());
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.