@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 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 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); } }
public void sessionDestroyed(HttpSession session) { // Mark the session context and conversation contexts to destroy // instances when appropriate deactivateSessionDestructionContext(session); boolean destroyed = getSessionContext().destroy(session); SessionHolder.clear(); RequestScopedCache.endRequest(); if (destroyed) { // we are outside of a request (the session timed out) and therefore the session was destroyed immediately // we can fire the @Destroyed(SessionScoped.class) event immediately sessionDestroyedEvent.fire(session); } else { // the old session won't be available at the time we destroy this request // let's store its reference until then if (getRequestContext() instanceof HttpRequestContextImpl) { HttpServletRequest request = Reflections.<HttpRequestContextImpl> cast(getRequestContext()).getHttpServletRequest(); request.setAttribute(HTTP_SESSION, session); } } }
public void sessionDestroyed(HttpSession session) { // Mark the session context and conversation contexts to destroy // instances when appropriate deactivateSessionDestructionContext(session); boolean destroyed = getSessionContext().destroy(session); SessionHolder.clear(); RequestScopedCache.endRequest(); if (destroyed) { // we are outside of a request (the session timed out) and therefore the session was destroyed immediately // we can fire the @Destroyed(SessionScoped.class) event immediately sessionDestroyedEvent.fire(session); } else { // the old session won't be available at the time we destroy this request // let's store its reference until then if (getRequestContext() instanceof HttpRequestContextImpl) { HttpServletRequest request = Reflections.<HttpRequestContextImpl> cast(getRequestContext()).getHttpServletRequest(); request.setAttribute(HTTP_SESSION, session); } } }
public void sessionDestroyed(HttpSession session) { // Mark the session context and conversation contexts to destroy // instances when appropriate deactivateSessionDestructionContext(session); boolean destroyed = getSessionContext().destroy(session); SessionHolder.clear(); RequestScopedCache.endRequest(); if (destroyed) { // we are outside of a request (the session timed out) and therefore the session was destroyed immediately // we can fire the @Destroyed(SessionScoped.class) event immediately sessionDestroyedEvent.fire(session); } else { // the old session won't be available at the time we destroy this request // let's store its reference until then if (getRequestContext() instanceof HttpRequestContextImpl) { HttpServletRequest request = Reflections.<HttpRequestContextImpl> cast(getRequestContext()).getHttpServletRequest(); request.setAttribute(HTTP_SESSION, session); } } }