/** * Pre-initialize the client runtime. */ public void preInitialize() { // pre-initialize MessageBodyWorkers injectionManager.getInstance(MessageBodyWorkers.class); }
/** * Pre-initialize the client runtime. */ public void preInitialize() { // pre-initialize MessageBodyWorkers injectionManager.getInstance(MessageBodyWorkers.class); }
/** * Pre-initialize the client runtime. */ public void preInitialize() { // pre-initialize MessageBodyWorkers injectionManager.getInstance(MessageBodyWorkers.class); }
@Override public Object apply(ContainerRequest request) { Class<?> rawType = parameter.getRawType(); Object fromHk2 = injectionManager.getInstance(rawType); if (fromHk2 != null) { // the bean parameter type is already bound in HK2, let's just take it from there return fromHk2; } ForeignDescriptor foreignDescriptor = descriptorCache.apply(rawType); return injectionManager.getInstance(foreignDescriptor); } }
@Override public void postInit(InjectionManager injectionManager, BootstrapBag bootstrapBag) { RequestScope requestScope = injectionManager.getInstance(RequestScope.class); bootstrapBag.setRequestScope(requestScope); } }
@Override public Object apply(ContainerRequest request) { Class<?> rawType = parameter.getRawType(); Object fromHk2 = injectionManager.getInstance(rawType); if (fromHk2 != null) { // the bean parameter type is already bound in HK2, let's just take it from there return fromHk2; } ForeignDescriptor foreignDescriptor = descriptorCache.apply(rawType); return injectionManager.getInstance(foreignDescriptor); } }
@Override public void postInit(InjectionManager injectionManager, BootstrapBag bootstrapBag) { RequestScope requestScope = injectionManager.getInstance(RequestScope.class); bootstrapBag.setRequestScope(requestScope); } }
@Override public Object create(final CreationalContext creationalContext) { return getEffectiveInjectionManager().getInstance(t); }
/** * Create an instance of this processor with injected {@link Configuration config} and (nullable) * {@link ServletContext servlet context}. * * @param config configuration to configure this processor from. * @param injectionManager injection manager. */ @Inject public MustacheTemplateProcessor(Configuration config, InjectionManager injectionManager) { super(config, injectionManager.getInstance(ServletContext.class), "mustache", "mustache"); this.factory = getTemplateObjectFactory(injectionManager::createAndInitialize, MustacheFactory.class, DefaultMustacheFactory::new); }
/** * Get {@link java.util.concurrent.ExecutorService}. * * @return Executor service associated with this container. */ ExecutorService getExecutorService() { return appHandler.getInjectionManager().getInstance(ExecutorServiceProvider.class).getExecutorService(); }
/** * Get {@link ScheduledExecutorService}. * * @return Scheduled executor service associated with this container. */ ScheduledExecutorService getScheduledExecutorService() { return appHandler.getInjectionManager().getInstance(ScheduledExecutorServiceProvider.class).getExecutorService(); } }
@Override public CompletionStageRxInvoker rx() { ExecutorServiceProvider instance = this.requestContext.getInjectionManager() .getInstance(ExecutorServiceProvider.class); return new JerseyCompletionStageRxInvoker(this, instance.getExecutorService()); }
@Override public <T extends RxInvoker> T rx(Class<T> clazz) { ExecutorServiceProvider instance = this.requestContext.getInjectionManager() .getInstance(ExecutorServiceProvider.class); return createRxInvoker(clazz, instance.getExecutorService()); }
@Override public CompletionStageRxInvoker rx() { ExecutorServiceProvider instance = this.requestContext.getInjectionManager() .getInstance(ExecutorServiceProvider.class); return new JerseyCompletionStageRxInvoker(this, instance.getExecutorService()); }
@Override public <T extends RxInvoker> T rx(Class<T> clazz) { ExecutorServiceProvider instance = this.requestContext.getInjectionManager() .getInstance(ExecutorServiceProvider.class); return createRxInvoker(clazz, instance.getExecutorService()); }
@Override public CompletionStageRxInvoker rx() { ExecutorServiceProvider instance = this.requestContext.getInjectionManager() .getInstance(ExecutorServiceProvider.class); return new JerseyCompletionStageRxInvoker(this, instance.getExecutorService()); }
@Override public void setAttributes(final ContainerRequestContext requestContext) { final RequestAttributes attributes; if (isWebApp) { final HttpServletRequest httpRequest = injectionManager.getInstance(HttpServletRequest.class); attributes = new JaxrsServletRequestAttributes(httpRequest, requestContext); } else { attributes = new JaxrsRequestAttributes(requestContext); } requestContext.setProperty(REQUEST_ATTRIBUTES_PROPERTY, attributes); RequestContextHolder.setRequestAttributes(attributes); }
private ApplicationContext createSpringContext() { ApplicationHandler applicationHandler = injectionManager.getInstance(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; }
@Override public void postInit(InjectionManager injectionManager, BootstrapBag bootstrapBag) { ServerBootstrapBag serverBag = (ServerBootstrapBag) bootstrapBag; List<ResourceMethodDispatcher.Provider> providers = Arrays.asList( new VoidVoidDispatcherProvider(serverBag.getResourceContext()), new JavaResourceMethodDispatcherProvider(serverBag.getValueParamProviders())); ResourceMethodInvoker.Builder builder = new ResourceMethodInvoker.Builder() .injectionManager(injectionManager) .resourceMethodDispatcherFactory(new ResourceMethodDispatcherFactory(providers)) .resourceMethodInvocationHandlerFactory(new ResourceMethodInvocationHandlerFactory(injectionManager)) .configuration(bootstrapBag.getConfiguration()) .configurationValidator(() -> injectionManager.getInstance(ConfiguredValidator.class)); serverBag.setResourceMethodInvokerBuilder(builder); } }
@Override public void postInit(InjectionManager injectionManager, BootstrapBag bootstrapBag) { ServerBootstrapBag serverBag = (ServerBootstrapBag) bootstrapBag; List<ResourceMethodDispatcher.Provider> providers = Arrays.asList( new VoidVoidDispatcherProvider(serverBag.getResourceContext()), new JavaResourceMethodDispatcherProvider(serverBag.getValueParamProviders())); ResourceMethodInvoker.Builder builder = new ResourceMethodInvoker.Builder() .injectionManager(injectionManager) .resourceMethodDispatcherFactory(new ResourceMethodDispatcherFactory(providers)) .resourceMethodInvocationHandlerFactory(new ResourceMethodInvocationHandlerFactory(injectionManager)) .configuration(bootstrapBag.getConfiguration()) .configurationValidator(() -> injectionManager.getInstance(ConfiguredValidator.class)); serverBag.setResourceMethodInvokerBuilder(builder); } }