Search in sources :

Example 1 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ServerContainerInitializeListener method createExecutor.

protected ExecutorService createExecutor(final ServletContext servletContext) {
    final EverrestConfiguration everrestConfiguration = getEverrestConfiguration(servletContext);
    final String threadNameFormat = "everrest.WSConnection." + servletContext.getServletContextName() + "-%d";
    return Executors.newFixedThreadPool(everrestConfiguration.getAsynchronousPoolSize(), new ThreadFactoryBuilder().setNameFormat(threadNameFormat).setUncaughtExceptionHandler(LoggingUncaughtExceptionHandler.getInstance()).setDaemon(true).build());
}
Also used : EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Example 2 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ServiceDescriptorTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    DependencySupplierImpl dependencies = new DependencySupplierImpl();
    ResourceBinder resources = new ResourceBinderImpl();
    ProviderBinder providers = new ApplicationProviderBinder();
    EverrestProcessor processor = new EverrestProcessor(new EverrestConfiguration(), dependencies, new RequestHandlerImpl(new RequestDispatcher(resources), providers), null);
    launcher = new ResourceLauncher(processor);
    processor.addApplication(new Deployer());
    ApplicationContext.setCurrent(anApplicationContext().withProviders(providers).build());
    System.out.println("initialized");
}
Also used : ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ProviderBinder(org.everrest.core.impl.ProviderBinder) DependencySupplierImpl(org.everrest.core.tools.DependencySupplierImpl) ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinderImpl(org.everrest.core.impl.ResourceBinderImpl) ResourceBinder(org.everrest.core.ResourceBinder) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) ResourceLauncher(org.everrest.core.tools.ResourceLauncher) RequestDispatcher(org.everrest.core.impl.RequestDispatcher) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class DownloadFileResponseFilterTest method before.

/**
     * Setup env for launching requests
     * @throws Exception
     */
@BeforeMethod
public void before() throws Exception {
    //set up launcher
    final ResourceBinderImpl resources = new ResourceBinderImpl();
    resources.addResource(MyJaxRSService.class, null);
    final DependencySupplierImpl dependencies = new DependencySupplierImpl();
    final ApplicationProviderBinder providers = new ApplicationProviderBinder();
    providers.addExceptionMapper(ApiExceptionMapper.class);
    providers.addResponseFilter(EverrestDownloadFileResponseFilter.class);
    final URI uri = new URI(BASE_URI);
    final ContainerRequest req = new ContainerRequest(null, uri, uri, null, null, null);
    final ApplicationContext context = anApplicationContext().withRequest(req).withProviders(providers).withDependencySupplier(dependencies).build();
    ApplicationContext.setCurrent(context);
    final EverrestProcessor processor = new EverrestProcessor(new EverrestConfiguration(), dependencies, new RequestHandlerImpl(new RequestDispatcher(resources), providers), null);
    resourceLauncher = new ResourceLauncher(processor);
}
Also used : DependencySupplierImpl(org.everrest.core.tools.DependencySupplierImpl) ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ApplicationContext.anApplicationContext(org.everrest.core.ApplicationContext.anApplicationContext) ApplicationContext(org.everrest.core.ApplicationContext) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinderImpl(org.everrest.core.impl.ResourceBinderImpl) ContainerRequest(org.everrest.core.impl.ContainerRequest) URI(java.net.URI) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) ResourceLauncher(org.everrest.core.tools.ResourceLauncher) RequestDispatcher(org.everrest.core.impl.RequestDispatcher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ETagResponseFilterTest method before.

/**
     * Setup env for launching requests
     * @throws Exception
     */
@BeforeMethod
public void before() throws Exception {
    //set up launcher
    final ResourceBinderImpl resources = new ResourceBinderImpl();
    resources.addResource(MyJaxRSService.class, null);
    final DependencySupplierImpl dependencies = new DependencySupplierImpl();
    final ApplicationProviderBinder providers = new ApplicationProviderBinder();
    providers.addExceptionMapper(ApiExceptionMapper.class);
    providers.addResponseFilter(ETagResponseFilter.class);
    final URI uri = new URI(BASE_URI);
    final ContainerRequest req = new ContainerRequest(null, uri, uri, null, null, null);
    final ApplicationContext contextImpl = anApplicationContext().withRequest(req).withProviders(providers).build();
    contextImpl.setDependencySupplier(dependencies);
    ApplicationContext.setCurrent(contextImpl);
    final EverrestProcessor processor = new EverrestProcessor(new EverrestConfiguration(), dependencies, new RequestHandlerImpl(new RequestDispatcher(resources), providers), null);
    resourceLauncher = new ResourceLauncher(processor);
}
Also used : DependencySupplierImpl(org.everrest.core.tools.DependencySupplierImpl) ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ApplicationContext.anApplicationContext(org.everrest.core.ApplicationContext.anApplicationContext) ApplicationContext(org.everrest.core.ApplicationContext) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinderImpl(org.everrest.core.impl.ResourceBinderImpl) ContainerRequest(org.everrest.core.impl.ContainerRequest) URI(java.net.URI) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) ResourceLauncher(org.everrest.core.tools.ResourceLauncher) RequestDispatcher(org.everrest.core.impl.RequestDispatcher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ServerContainerInitializeListener method getEverrestProcessor.

protected EverrestProcessor getEverrestProcessor(ServletContext servletContext) {
    final DependencySupplier dependencies = (DependencySupplier) servletContext.getAttribute(DependencySupplier.class.getName());
    final ResourceBinder resources = (ResourceBinder) servletContext.getAttribute(ResourceBinder.class.getName());
    final ProviderBinder providers = (ProviderBinder) servletContext.getAttribute(ApplicationProviderBinder.class.getName());
    final EverrestConfiguration copyOfEverrestConfiguration = new EverrestConfiguration(getEverrestConfiguration(servletContext));
    copyOfEverrestConfiguration.setProperty(EverrestConfiguration.METHOD_INVOKER_DECORATOR_FACTORY, WebSocketMethodInvokerDecoratorFactory.class.getName());
    final RequestHandlerImpl requestHandler = new RequestHandlerImpl(new RequestDispatcher(resources), providers);
    return new EverrestProcessor(copyOfEverrestConfiguration, dependencies, requestHandler, null);
}
Also used : ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ProviderBinder(org.everrest.core.impl.ProviderBinder) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) DependencySupplier(org.everrest.core.DependencySupplier) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinder(org.everrest.core.ResourceBinder) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) RequestDispatcher(org.everrest.core.impl.RequestDispatcher)

Aggregations

EverrestConfiguration (org.everrest.core.impl.EverrestConfiguration)7 EverrestProcessor (org.everrest.core.impl.EverrestProcessor)5 RequestDispatcher (org.everrest.core.impl.RequestDispatcher)5 RequestHandlerImpl (org.everrest.core.impl.RequestHandlerImpl)5 ApplicationProviderBinder (org.everrest.core.impl.ApplicationProviderBinder)4 ResourceBinderImpl (org.everrest.core.impl.ResourceBinderImpl)4 DependencySupplierImpl (org.everrest.core.tools.DependencySupplierImpl)4 ResourceLauncher (org.everrest.core.tools.ResourceLauncher)4 ResourceBinder (org.everrest.core.ResourceBinder)3 ProviderBinder (org.everrest.core.impl.ProviderBinder)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 URI (java.net.URI)2 ApplicationContext (org.everrest.core.ApplicationContext)2 ApplicationContext.anApplicationContext (org.everrest.core.ApplicationContext.anApplicationContext)2 ContainerRequest (org.everrest.core.impl.ContainerRequest)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 File (java.io.File)1 PathMatcher (java.nio.file.PathMatcher)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1