@Override protected HttpServletRequest newInstance(InjectionPoint ip, CreationalContext<HttpServletRequest> creationalContext) { try { Context context = getBeanManager().getContext(RequestScoped.class); if (context instanceof HttpRequestContextImpl) { return Reflections.<HttpRequestContextImpl> cast(context).getHttpServletRequest(); } throw ServletLogger.LOG.cannotInjectObjectOutsideOfServletRequest(HttpServletRequest.class.getSimpleName(), null); } catch (ContextNotActiveException e) { throw ServletLogger.LOG.cannotInjectObjectOutsideOfServletRequest(HttpServletRequest.class.getSimpleName(), e); } }
beanDeployer.addBuiltInBean(new DecoratorMetadataBean(beanManager)); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { beanDeployer.addBuiltInBean(new HttpServletRequestBean(beanManager)); beanDeployer.addBuiltInBean(new HttpSessionBean(beanManager)); beanDeployer.addBuiltInBean(new ServletContextBean(beanManager));