Codota Logo
SessionHolder
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
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

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 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

@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 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

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JTable (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now