private static Environment detectEnvironment() { // We should rather use the environment from WeldStartup but it's not available in the static initializer Environment environment = null; if (Reflections.isClassLoadable(WELD_SE_CLASS, WeldClassLoaderResourceLoader.INSTANCE)) { environment = Environments.SE; } else if (Reflections.isClassLoadable(WELD_SERVLET_CLASS, WeldClassLoaderResourceLoader.INSTANCE)) { environment = Environments.SERVLET; } return environment; } }
@Override public boolean isEnabled() { return Reflections.isClassLoadable(GROOVY_OBJECT, WeldClassLoaderResourceLoader.INSTANCE); }
@Override public boolean isEnabled() { return Reflections.isClassLoadable(GROOVY_OBJECT, WeldClassLoaderResourceLoader.INSTANCE); }
private Map<String, Object> getExternalConfigurationOptions(ServiceRegistry services) { // to stay compatible with older SPI versions we first check if ExternalConfiguration is available before using the class if (Reflections.isClassLoadable(EXTERNAL_CONFIGURATION_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { final ExternalConfiguration externalConfiguration = services.get(ExternalConfiguration.class); if (externalConfiguration != null) { return externalConfiguration.getConfigurationProperties(); } } return Collections.emptyMap(); }
private Map<String, Object> getExternalConfigurationOptions(ServiceRegistry services) { // to stay compatible with older SPI versions we first check if ExternalConfiguration is available before using the class if (Reflections.isClassLoadable(EXTERNAL_CONFIGURATION_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { final ExternalConfiguration externalConfiguration = services.get(ExternalConfiguration.class); if (externalConfiguration != null) { return externalConfiguration.getConfigurationProperties(); } } return Collections.emptyMap(); }
public ServletApiAbstraction(ResourceLoader resourceLoader) { super(resourceLoader); this.asyncSupported = Reflections.isClassLoadable(ASYNC_LISTENER_CONTEXT_CLASS_NAME, resourceLoader); Method isAsyncStartedMethodLocal = null; Class<ServletRequest> servletRequestClass = Reflections.loadClass(SERVLET_REQUEST_CLASS_NAME, resourceLoader); if (servletRequestClass != null) { try { isAsyncStartedMethodLocal = servletRequestClass.getMethod(IS_ASYNC_STARTED_METHOD_NAME); } catch (NoSuchMethodException e) { ServletLogger.LOG.servlet2Environment(); } } isAsyncStartedMethod = isAsyncStartedMethodLocal; }
private Map<String, Object> getExternalConfigurationOptions(ServiceRegistry services) { // to stay compatible with older SPI versions we first check if ExternalConfiguration is available before using the class if (Reflections.isClassLoadable(EXTERNAL_CONFIGURATION_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { final ExternalConfiguration externalConfiguration = services.get(ExternalConfiguration.class); if (externalConfiguration != null) { return externalConfiguration.getConfigurationProperties(); } } return Collections.emptyMap(); }
private Map<String, Object> getExternalConfigurationOptions(ServiceRegistry services) { // to stay compatible with older SPI versions we first check if ExternalConfiguration is available before using the class if (Reflections.isClassLoadable(EXTERNAL_CONFIGURATION_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { final ExternalConfiguration externalConfiguration = services.get(ExternalConfiguration.class); if (externalConfiguration != null) { return externalConfiguration.getConfigurationProperties(); } } return Collections.emptyMap(); }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public ServletApiAbstraction(ResourceLoader resourceLoader) { super(resourceLoader); this.asyncSupported = Reflections.isClassLoadable(ASYNC_LISTENER_CONTEXT_CLASS_NAME, resourceLoader); Method isAsyncStartedMethodLocal = null; Class<ServletRequest> servletRequestClass = Reflections.loadClass(SERVLET_REQUEST_CLASS_NAME, resourceLoader); if (servletRequestClass != null) { try { isAsyncStartedMethodLocal = servletRequestClass.getMethod(IS_ASYNC_STARTED_METHOD_NAME); } catch (NoSuchMethodException e) { ServletLogger.LOG.servlet2Environment(); } } isAsyncStartedMethod = isAsyncStartedMethodLocal; }
private Map<String, Object> getExternalConfigurationOptions(ServiceRegistry services) { // to stay compatible with older SPI versions we first check if ExternalConfiguration is available before using the class if (Reflections.isClassLoadable(EXTERNAL_CONFIGURATION_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { final ExternalConfiguration externalConfiguration = services.get(ExternalConfiguration.class); if (externalConfiguration != null) { return externalConfiguration.getConfigurationProperties(); } } return Collections.emptyMap(); }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
@Override public void preBeanRegistration(PreBeanRegistrationContext ctx) { if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { ctx.registerBean(new HttpServletRequestBean(ctx.getBeanManager())); ctx.registerBean(new HttpSessionBean(ctx.getBeanManager())); ctx.registerBean(new ServletContextBean(ctx.getBeanManager())); } } }
@Override public void preBeanRegistration(PreBeanRegistrationContext ctx) { if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { ctx.registerBean(new HttpServletRequestBean(ctx.getBeanManager())); ctx.registerBean(new HttpSessionBean(ctx.getBeanManager())); ctx.registerBean(new ServletContextBean(ctx.getBeanManager())); } } }
@Override public void preBeanRegistration(PreBeanRegistrationContext ctx) { if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { ctx.registerBean(new HttpServletRequestBean(ctx.getBeanManager())); ctx.registerBean(new HttpSessionBean(ctx.getBeanManager())); ctx.registerBean(new ServletContextBean(ctx.getBeanManager())); } } }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { final BeanIdentifierIndex index = ctx.getServices().get(BeanIdentifierIndex.class); final String contextId = ctx.getContextId(); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { // Register the Http contexts if not in Set<Annotation> httpQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(HttpLiteral.INSTANCE).build(); ctx.addContext(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, index), HttpSessionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, index), HttpSessionDestructionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, ctx.getServices()), HttpConversationContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); } }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { final BeanIdentifierIndex index = ctx.getServices().get(BeanIdentifierIndex.class); final String contextId = ctx.getContextId(); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { // Register the Http contexts if not in Set<Annotation> httpQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(HttpLiteral.INSTANCE).build(); ctx.addContext(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, index), HttpSessionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, index), HttpSessionDestructionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, ctx.getServices()), HttpConversationContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); } }