/** * Returns the application handler service locator * * @return inner service locator */ @Override public ServiceLocator getServiceLocator() { return delegate.getServiceLocator(); }
/** * Returns the application handler service locator * * @return inner service locator */ @Override public ServiceLocator getServiceLocator() { return delegate.getServiceLocator(); }
/** * Returns the application handler service locator * * @return inner service locator */ @Override public ServiceLocator getServiceLocator() { return delegate.getServiceLocator(); }
/** * Return the first found {@link AsyncContextDelegateProvider} * (via {@link Providers#getAllProviders(org.glassfish.hk2.api.ServiceLocator, Class)}) or {@code #DEFAULT_ASYNC_DELEGATE} if * other delegate cannot be found. * * @return a non-null AsyncContextDelegateProvider. */ private AsyncContextDelegateProvider getAsyncExtensionDelegate() { final Iterator<AsyncContextDelegateProvider> providers = Providers.getAllProviders(appHandler.getServiceLocator(), AsyncContextDelegateProvider.class).iterator(); if (providers.hasNext()) { return providers.next(); } return new AsyncContextDelegateProvider() { @Override public AsyncContextDelegate createDelegate(final HttpServletRequest request, final HttpServletResponse response) { return DEFAULT_ASYNC_DELEGATE; } }; }
/** * Return the first found {@link AsyncContextDelegateProvider} * (via {@link Providers#getAllProviders(org.glassfish.hk2.api.ServiceLocator, Class)}) or {@code #DEFAULT_ASYNC_DELEGATE} if * other delegate cannot be found. * * @return a non-null AsyncContextDelegateProvider. */ private AsyncContextDelegateProvider getAsyncExtensionDelegate() { final Iterator<AsyncContextDelegateProvider> providers = Providers.getAllProviders(appHandler.getServiceLocator(), AsyncContextDelegateProvider.class).iterator(); if (providers.hasNext()) { return providers.next(); } return new AsyncContextDelegateProvider() { @Override public AsyncContextDelegate createDelegate(final HttpServletRequest request, final HttpServletResponse response) { return DEFAULT_ASYNC_DELEGATE; } }; }
/** * Return the first found {@link AsyncContextDelegateProvider} * (via {@link Providers#getAllProviders(org.glassfish.hk2.api.ServiceLocator, Class)}) or {@code #DEFAULT_ASYNC_DELEGATE} if * other delegate cannot be found. * * @return a non-null AsyncContextDelegateProvider. */ private AsyncContextDelegateProvider getAsyncExtensionDelegate() { final Iterator<AsyncContextDelegateProvider> providers = Providers.getAllProviders(appHandler.getServiceLocator(), AsyncContextDelegateProvider.class).iterator(); if (providers.hasNext()) { return providers.next(); } return new AsyncContextDelegateProvider() { @Override public AsyncContextDelegate createDelegate(final HttpServletRequest request, final HttpServletResponse response) { return DEFAULT_ASYNC_DELEGATE; } }; }
@Override public ServiceLocator get() { ServletContainer container = (ServletContainer) environment.getJerseyServletContainer(); checkState(container != null, "Servlet-container not ready"); return container.getApplicationHandler().getServiceLocator(); } }
/** * Resolve the {@link FilterUrlMappingsProvider} service via hk2. * * Will only work in Servlet 3 container, as the older API version * does not provide access to the filter mapping structure. * * @return {@code FilterContextPath} instance, if available, {@code null} otherwise. */ private FilterUrlMappingsProvider getFilterUrlMappingsProvider() { FilterUrlMappingsProvider filterUrlMappingsProvider = null; final Iterator<FilterUrlMappingsProvider> providers = Providers.getAllProviders( getApplicationHandler().getServiceLocator(), FilterUrlMappingsProvider.class).iterator(); if (providers.hasNext()) { filterUrlMappingsProvider = providers.next(); } return filterUrlMappingsProvider; }
/** * Resolve the {@link FilterUrlMappingsProvider} service via hk2. * * Will only work in Servlet 3 container, as the older API version * does not provide access to the filter mapping structure. * * @return {@code FilterContextPath} instance, if available, {@code null} otherwise. */ private FilterUrlMappingsProvider getFilterUrlMappingsProvider() { FilterUrlMappingsProvider filterUrlMappingsProvider = null; final Iterator<FilterUrlMappingsProvider> providers = Providers.getAllProviders( getApplicationHandler().getServiceLocator(), FilterUrlMappingsProvider.class).iterator(); if (providers.hasNext()) { filterUrlMappingsProvider = providers.next(); } return filterUrlMappingsProvider; }
/** * Resolve the {@link FilterUrlMappingsProvider} service via hk2. * * Will only work in Servlet 3 container, as the older API version * does not provide access to the filter mapping structure. * * @return {@code FilterContextPath} instance, if available, {@code null} otherwise. */ private FilterUrlMappingsProvider getFilterUrlMappingsProvider() { FilterUrlMappingsProvider filterUrlMappingsProvider = null; final Iterator<FilterUrlMappingsProvider> providers = Providers.getAllProviders( getApplicationHandler().getServiceLocator(), FilterUrlMappingsProvider.class).iterator(); if (providers.hasNext()) { filterUrlMappingsProvider = providers.next(); } return filterUrlMappingsProvider; }
@Override public void onStartup(Container container) { final ServiceLocator locator = container.getApplicationHandler().getServiceLocator(); // TODO: Avoid useless Job instantiation. Note: Same as GuiceJobManager and SpringJobManager. @SuppressWarnings("unchecked") final List<Job> jobs = (List<Job>) locator.getAllServices(searchCriteria); jobManager = new JobManager(configuration, jobs.toArray(new Job[jobs.size()])) { @Override protected JobFactory getJobFactory() { return (bundle, scheduler) -> (org.quartz.Job) locator.getAllServiceHandles(searchCriteria).stream() .filter(sh -> sh.getActiveDescriptor().getImplementationClass() .equals(bundle.getJobDetail().getJobClass())) .findFirst().orElseThrow(IllegalStateException::new).getService(); } }; try { jobManager.start(); } catch (Exception ex) { throw new IllegalStateException(ex); } }
this.configSetStatusOverSendError = ServerProperties.getValue(resourceConfig.getProperties(), ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, false, Boolean.class); this.backgroundTaskScheduler = appHandler.getServiceLocator() .getService(ScheduledExecutorService.class, BackgroundSchedulerLiteral.INSTANCE);
this.configSetStatusOverSendError = ServerProperties.getValue(resourceConfig.getProperties(), ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, false, Boolean.class); this.backgroundTaskScheduler = appHandler.getServiceLocator() .getService(ScheduledExecutorService.class, BackgroundSchedulerLiteral.INSTANCE);
this.configSetStatusOverSendError = ServerProperties.getValue(resourceConfig.getProperties(), ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, false, Boolean.class); this.backgroundTaskScheduler = appHandler.getServiceLocator() .getService(ScheduledExecutorService.class, BackgroundSchedulerLiteral.INSTANCE);