Tabnine Logo
SessionHolder
Code IndexAdd Tabnine to your IDE (free)

How to use
SessionHolder
in
org.jboss.weld.servlet

Best Java code snippets using org.jboss.weld.servlet.SessionHolder (Showing top 12 results out of 315)

origin: org.jboss.weld.se/weld-se

@Override
protected HttpSession getSessionFromRequest(HttpServletRequest request, boolean create) {
  return SessionHolder.getSession(request, create);
}
origin: org.jboss.weld.se/weld-se

/**
 * Get the session, create equals false;
 * @return http session or null if no such session exists
 */
protected HttpSession getSessionIfExists() {
  return SessionHolder.getSessionIfExists();
}
origin: errai/errai

@Override
public void deactivateContext() {
 HttpSessionContext sessionContext = beanManager.instance().select(HttpSessionContext.class).get();
 SessionHolder.clear();
 sessionContext.dissociate(simulatedHttpRequest.get());
}

origin: errai/errai

@Override
public void activateContext(HttpSession httpSession) {
 HttpSessionContext sessionContext = beanManager.instance().select(HttpSessionContext.class).get();
 simulatedHttpRequest.set(new FakeHttpServletRequest(httpSession));
 SessionHolder.requestInitialized(simulatedHttpRequest.get());
 sessionContext.associate(simulatedHttpRequest.get());
 sessionContext.activate();
 getOrCreateBeanStore(httpSession);
}
origin: org.jboss.weld.se/weld-se

public void sessionCreated(HttpSession session) {
  SessionHolder.sessionCreated(session);
  conversationContextActivator.sessionCreated(session);
  sessionInitializedEvent.fire(session);
}
origin: org.jboss.weld.se/weld-se

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);
    }
  }
}
origin: org.jboss.weld.se/weld-se

SessionHolder.requestInitialized(request);
origin: org.jboss.weld.se/weld-se

SessionHolder.clear();
origin: org.jboss.weld.se/weld-se

@Override
protected Object getSessionAttribute(HttpServletRequest request, String name, boolean create) {
  if (create || SessionHolder.getSessionIfExists() != null) {
    return getSessionFromRequest(request, true).getAttribute(name);
  } else {
    return null;
  }
}
origin: org.jboss.weld.se/weld-se

@Override
protected HttpSession getSession(boolean create) {
  try {
    return SessionHolder.getSession(request, create);
  } catch (IllegalStateException e) {
    // If container can't create an underlying session, invalidate the
    // current one
    detach();
    return null;
  }
}
origin: org.jboss.weld.se/weld-se

private HttpSession obtainHttpSession() {
  HttpSession session = SessionHolder.getSessionIfExists();
  if (session == null) {
    throw ServletLogger.LOG.cannotInjectObjectOutsideOfServletRequest(HttpSession.class.getSimpleName(), null);
  }
  return session;
}
origin: org.jboss.weld.se/weld-se

@Override
protected void setSessionAttribute(HttpServletRequest request, String name, Object value, boolean create) {
  if (create || SessionHolder.getSessionIfExists() != null) {
    getSessionFromRequest(request, true).setAttribute(name, value);
  }
}
org.jboss.weld.servletSessionHolder

Javadoc

Holds the session associated with the current request. This utility class was added to work around an incompatibility problem with some Servlet containers (JBoss Web, Tomcat). In these containers, HttpServletRequest#getSession(boolean) cannot be used within HttpSessionListener#sessionCreated(HttpSession) method invocation is the created session is not made available. As a result either null is returned or a new session is created (possibly causing an endless loop). This utility class receives an HttpSession once it is created and holds it until the request is destroyed / session is invalidated.

Most used methods

  • clear
  • requestInitialized
  • getSession
  • getSessionIfExists
  • sessionCreated

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • String (java.lang)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now