Search in sources :

Example 26 with Manager

use of org.apache.catalina.Manager in project Payara by payara.

the class ApplicationHttpRequest method isRequestedSessionIdValid.

/**
 * Returns true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 *
 * @return true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 */
@Override
public boolean isRequestedSessionIdValid() {
    if (crossContext) {
        String requestedSessionId = getRequestedSessionId();
        if (requestedSessionId == null)
            return (false);
        if (context == null)
            return (false);
        if (session != null && requestedSessionId.equals(session.getIdInternal())) {
            return session.isValid();
        }
        Manager manager = context.getManager();
        if (manager == null)
            return (false);
        Session localSession = null;
        try {
            if (isSessionVersioningSupported) {
                localSession = manager.findSession(requestedSessionId, requestedSessionVersion);
            } else {
                localSession = manager.findSession(requestedSessionId);
            }
        } catch (IOException e) {
            localSession = null;
        }
        if ((localSession != null) && localSession.isValid()) {
            return (true);
        } else {
            return (false);
        }
    } else {
        return super.isRequestedSessionIdValid();
    }
}
Also used : IOException(java.io.IOException) Manager(org.apache.catalina.Manager) Session(org.apache.catalina.Session) StandardSession(org.apache.catalina.session.StandardSession)

Example 27 with Manager

use of org.apache.catalina.Manager in project Payara by payara.

the class ContainerBase method setManager.

/**
 * Set the Manager with which this Container is associated.
 *
 * @param manager The newly associated Manager
 */
@Override
public void setManager(Manager manager) {
    Manager oldManager;
    try {
        writeLock.lock();
        // Change components if necessary
        oldManager = this.manager;
        if (oldManager == manager)
            return;
        this.manager = manager;
        // Stop the old component if necessary
        if (started && (oldManager != null) && (oldManager instanceof Lifecycle)) {
            try {
                ((Lifecycle) oldManager).stop();
            } catch (LifecycleException e) {
                log.log(Level.SEVERE, LogFacade.CONTAINER_BASE_SET_MANAGER_STOP, e);
            }
        }
        // Start the new component if necessary
        if (manager != null)
            manager.setContainer(this);
        if (started && (manager != null) && (manager instanceof Lifecycle)) {
            try {
                ((Lifecycle) manager).start();
            } catch (LifecycleException e) {
                log.log(Level.SEVERE, LogFacade.CONTAINER_BASE_SET_MANAGER_START, e);
            }
        }
    } finally {
        writeLock.unlock();
    }
    // Report this property change to interested listeners
    support.firePropertyChange("manager", oldManager, this.manager);
}
Also used : LifecycleException(org.apache.catalina.LifecycleException) Lifecycle(org.apache.catalina.Lifecycle) Manager(org.apache.catalina.Manager)

Example 28 with Manager

use of org.apache.catalina.Manager in project Payara by payara.

the class HAStoreBase method remove.

// SJSAS 6406580 START
/**
 * Remove the Session with the specified session identifier from
 * this Store, if present.  If no such Session is present, this method
 * takes no action.
 *
 * @param id Session identifier of the Session to be removed
 *
 * @exception IOException if an input/output error occurs
 */
public void remove(String id) throws IOException {
    if (_debug > 0) {
        debug("in remove");
    }
    if (id == null) {
        if (_debug > 0) {
            debug("In remove, got a null id");
        }
        return;
    }
    Manager mgr = this.getManager();
    if (mgr instanceof ReplicationManagerBase) {
        ReplicationManagerBase pMgr = (ReplicationManagerBase) mgr;
        pMgr.doRemove(id);
    } else {
        this.removeSynchronized(id);
    }
}
Also used : Manager(org.apache.catalina.Manager)

Example 29 with Manager

use of org.apache.catalina.Manager in project Payara by payara.

the class BaseHASession method sync.

public void sync() {
    HttpSessionBindingEvent event = null;
    event = new HttpSessionBindingEvent((HttpSession) this, null, null);
    // Notify special event listeners on sync()
    Manager manager = this.getManager();
    StandardContext stdContext = (StandardContext) manager.getContainer();
    // fire container event
    stdContext.fireContainerEvent("sessionSync", event);
}
Also used : HttpSessionBindingEvent(javax.servlet.http.HttpSessionBindingEvent) HttpSession(javax.servlet.http.HttpSession) StandardContext(org.apache.catalina.core.StandardContext) Manager(org.apache.catalina.Manager)

Example 30 with Manager

use of org.apache.catalina.Manager in project Payara by payara.

the class HASessionStoreValve method doPostInvoke.

/**
 * A post-request processing implementation that does the valveSave.
 * @param request
 * @param response
 */
private void doPostInvoke(Request request, Response response) throws IOException, ServletException {
    if (_logger.isLoggable(Level.FINEST)) {
        _logger.finest("IN HASessionStoreValve>>postInvoke()");
    }
    String sessionId = null;
    Session session;
    StandardContext context;
    Manager manager;
    HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
    HttpSession hsess = hreq.getSession(false);
    if (hsess != null) {
        sessionId = hsess.getId();
        if (_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN HASessionStoreValve:postInvoke:sessionId=" + sessionId);
        }
    }
    if (sessionId != null) {
        context = (StandardContext) request.getContext();
        manager = context.getManager();
        session = manager.findSession(sessionId);
        if (_logger.isLoggable(Level.FINEST)) {
            _logger.finest("IN HASessionStoreValve:postInvoke:session=" + session);
        }
        if (session != null) {
            WebEventPersistentManager pMgr = (WebEventPersistentManager) manager;
            pMgr.doValveSave(session);
        }
    }
    HACookieManager.reset();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpSession(javax.servlet.http.HttpSession) StandardContext(org.apache.catalina.core.StandardContext) HACookieManager(org.glassfish.ha.common.HACookieManager) Manager(org.apache.catalina.Manager) HttpSession(javax.servlet.http.HttpSession) Session(org.apache.catalina.Session)

Aggregations

Manager (org.apache.catalina.Manager)54 StringManager (org.apache.tomcat.util.res.StringManager)26 IOException (java.io.IOException)22 Session (org.apache.catalina.Session)22 Context (org.apache.catalina.Context)19 Container (org.apache.catalina.Container)13 LifecycleException (org.apache.catalina.LifecycleException)12 Lifecycle (org.apache.catalina.Lifecycle)11 Loader (org.apache.catalina.Loader)11 InstanceManager (org.apache.tomcat.InstanceManager)11 StandardManager (org.apache.catalina.session.StandardManager)10 Realm (org.apache.catalina.Realm)9 ServletException (javax.servlet.ServletException)7 ArrayList (java.util.ArrayList)6 NamingException (javax.naming.NamingException)6 Cluster (org.apache.catalina.Cluster)6 DistributedManager (org.apache.catalina.DistributedManager)6 StandardContext (org.apache.catalina.core.StandardContext)6 WebappLoader (org.apache.catalina.loader.WebappLoader)6 ServletException (jakarta.servlet.ServletException)5