@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); } }
@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 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); } }
@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 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); } }