org.apache.catalina.Manager Java Examples

The following examples show how to use org.apache.catalina.Manager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JvmRouteBinderValve.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Detect possible the JVMRoute change at cluster backup node..
 *
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager))) {
            handlePossibleTurnover(request);
        }
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
 
Example #2
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Create new Manager without add to cluster (comes with start the manager)
 * 
 * @param name
 *            Context Name of this manager
 * @see org.apache.catalina.Cluster#createManager(java.lang.String)
 * @see DeltaManager#start()
 */
@Override
public synchronized Manager createManager(String name) {
    if (log.isDebugEnabled()) {
        log.debug("Creating ClusterManager for context " + name +
                " using class " + getManagerTemplate().getClass().getName());
    }
    ClusterManager manager = null;
    try {
        manager = managerTemplate.cloneFromTemplate();
        manager.setName(name);
    } catch (Exception x) {
        log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
        manager = new org.apache.catalina.ha.session.DeltaManager();
    } finally {
        if ( manager != null) manager.setCluster(this);
    }
    return manager;
}
 
Example #3
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void registerManager(Manager manager) {

    if (! (manager instanceof ClusterManager)) {
        log.warn("Manager [ " + manager + "] does not implement ClusterManager, addition to cluster has been aborted.");
        return;
    }
    ClusterManager cmanager = (ClusterManager) manager ;
    cmanager.setDistributable(true);
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
    String clusterName = getManagerName(cmanager.getName(), manager);
    cmanager.setName(clusterName);
    cmanager.setCluster(this);

    managers.put(clusterName, cmanager);
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);    
}
 
Example #4
Source File: JvmRouteBinderValve.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
 
Example #5
Source File: TomcatValve4150.java    From flex-blazeds with Apache License 2.0 6 votes vote down vote up
static Session getSession(HttpRequest request, boolean create) 
{

    HttpServletRequest hreq =
        (HttpServletRequest) request.getRequest();

    HttpSession hses = hreq.getSession(create);

    if (hses == null)
        return (null);
    Manager manager = request.getContext().getManager();

    if (manager == null)
        return (null);
    else 
    {
        try 
        {
            return (manager.findSession(hses.getId()));
        } catch (IOException e) 
        {
            Log.getLogger(LogCategories.SECURITY).error("Error in TomcatValve getting session id " + hses.getId() + " : " + ExceptionUtil.toString(e));
            return (null);
        }
    }
}
 
Example #6
Source File: SingleSignOnListener.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void sessionEvent(SessionEvent event) {
    if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
        return;
    }

    Session session = event.getSession();
    Manager manager = session.getManager();
    if (manager == null) {
        return;
    }
    Context context = (Context) manager.getContainer();
    Authenticator authenticator = context.getAuthenticator();
    if (!(authenticator instanceof AuthenticatorBase)) {
        return;
    }
    SingleSignOn sso = ((AuthenticatorBase) authenticator).sso;
    if (sso == null) {
        return;
    }
    sso.sessionDestroyed(ssoId, session);
}
 
Example #7
Source File: Request.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Changes the session ID of the session associated with this request.
 *
 * @return the old session ID before it was changed
 * @see javax.servlet.http.HttpSessionIdListener
 * @since Servlet 3.1
 */
@Override
public String changeSessionId() {

    Session session = this.getSessionInternal(false);
    if (session == null) {
        throw new IllegalStateException(
            sm.getString("coyoteRequest.changeSessionId"));
    }

    Manager manager = this.getContext().getManager();
    manager.changeSessionId(session);

    String newSessionId = session.getId();
    this.changeSessionId(newSessionId);

    return newSessionId;
}
 
Example #8
Source File: SingleSignOnListener.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void sessionEvent(SessionEvent event) {
    if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
        return;
    }

    Session session = event.getSession();
    Manager manager = session.getManager();
    if (manager == null) {
        return;
    }
    Context context = manager.getContext();
    Authenticator authenticator = context.getAuthenticator();
    if (!(authenticator instanceof AuthenticatorBase)) {
        return;
    }
    SingleSignOn sso = ((AuthenticatorBase) authenticator).sso;
    if (sso == null) {
        return;
    }
    sso.sessionDestroyed(ssoId, session);
}
 
Example #9
Source File: SimpleTcpCluster.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void registerManager(Manager manager) {

    if (! (manager instanceof ClusterManager)) {
        log.warn(sm.getString("simpleTcpCluster.clustermanager.notImplement", manager));
        return;
    }
    ClusterManager cmanager = (ClusterManager) manager;
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
    String clusterName = getManagerName(cmanager.getName(), manager);
    cmanager.setName(clusterName);
    cmanager.setCluster(this);

    managers.put(clusterName, cmanager);
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);
}
 
Example #10
Source File: Tomcat7Valve.java    From flex-blazeds with Apache License 2.0 6 votes vote down vote up
static Session getSession(Request request, boolean create) 
{

    HttpServletRequest hreq = (HttpServletRequest)request.getRequest();
    HttpSession hses = hreq.getSession(create);

    if (hses == null)
        return null;

    Manager manager = request.getContext().getManager();
    if (manager == null)
        return null;

    try 
    {
        return manager.findSession(hses.getId());
    }
    catch (IOException e) 
    {
        Log.getLogger(LogCategories.SECURITY).error("Error in TomcatValve getting session id " + hses.getId() + " : " + ExceptionUtil.toString(e));
        return null;
    }
}
 
Example #11
Source File: SimpleTcpCluster.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void registerManager(Manager manager) {

    if (! (manager instanceof ClusterManager)) {
        log.warn("Manager [ " + manager + "] does not implement ClusterManager, addition to cluster has been aborted.");
        return;
    }
    ClusterManager cmanager = (ClusterManager) manager;
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
    String clusterName = getManagerName(cmanager.getName(), manager);
    cmanager.setName(clusterName);
    cmanager.setCluster(this);

    managers.put(clusterName, cmanager);
    // Notify our interested LifecycleListeners
    fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);    
}
 
Example #12
Source File: JvmRouteBinderValve.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
 
Example #13
Source File: TomcatEmbeddedContext.java    From spring-graalvm-native with Apache License 2.0 5 votes vote down vote up
@Override
public void setManager(Manager manager) {
	if (manager instanceof ManagerBase) {
		manager.setSessionIdGenerator(new LazySessionIdGenerator());
	}
	super.setManager(manager);
}
 
Example #14
Source File: MetricsServletModule.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  Multibinder<MeterBinder> meterMultibinder =
      Multibinder.newSetBinder(binder(), MeterBinder.class);
  meterMultibinder.addBinding().toProvider(TomcatMetricsProvider.class);

  bind(Manager.class).toInstance(getManager(getServletContext()));
  filter("/*").through(ApiResponseMetricFilter.class);
}
 
Example #15
Source File: TomcatMetricsBinder.java    From foremast with Apache License 2.0 5 votes vote down vote up
private Manager findManager(ApplicationContext applicationContext) {
    if (applicationContext instanceof EmbeddedWebApplicationContext) {
        EmbeddedServletContainer container = ((EmbeddedWebApplicationContext) applicationContext).getEmbeddedServletContainer();
        if (container instanceof TomcatEmbeddedServletContainer) {
            Context context = findContext((TomcatEmbeddedServletContainer) container);
            if (context != null) {
                return context.getManager();
            }
        }
    }
    return null;
}
 
Example #16
Source File: TomcatMetrics.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private void registerSessionMetrics(MeterRegistry registry) {
    if (manager == null) {
        // If the binder is created but unable to find the session manager don't register those metrics
        return;
    }

    Gauge.builder("tomcat.sessions.active.max", manager, Manager::getMaxActive)
            .tags(tags)
            .baseUnit(BaseUnits.SESSIONS)
            .register(registry);

    Gauge.builder("tomcat.sessions.active.current", manager, Manager::getActiveSessions)
            .tags(tags)
            .baseUnit(BaseUnits.SESSIONS)
            .register(registry);

    FunctionCounter.builder("tomcat.sessions.created", manager, Manager::getSessionCounter)
            .tags(tags)
            .baseUnit(BaseUnits.SESSIONS)
            .register(registry);

    FunctionCounter.builder("tomcat.sessions.expired", manager, Manager::getExpiredSessions)
            .tags(tags)
            .baseUnit(BaseUnits.SESSIONS)
            .register(registry);

    FunctionCounter.builder("tomcat.sessions.rejected", manager, Manager::getRejectedSessions)
            .tags(tags)
            .baseUnit(BaseUnits.SESSIONS)
            .register(registry);

    TimeGauge.builder("tomcat.sessions.alive.max", manager, TimeUnit.SECONDS, Manager::getSessionMaxAliveTime)
            .tags(tags)
            .register(registry);
}
 
Example #17
Source File: ReplicationValve.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 * 
 * @param request
 * @throws IOException
 */
protected void createPrimaryIndicator(Request request) throws IOException {
    String id = request.getRequestedSessionId();
    if ((id != null) && (id.length() > 0)) {
        Manager manager = request.getContext().getManager();
        Session session = manager.findSession(id);
        if (session instanceof ClusterSession) {
            ClusterSession cses = (ClusterSession) session;
            if (log.isDebugEnabled())
                log.debug(sm.getString(
                        "ReplicationValve.session.indicator", request.getContext().getName(),id,
                        primaryIndicatorName,
                        Boolean.valueOf(cses.isPrimarySession())));
            request.setAttribute(primaryIndicatorName, cses.isPrimarySession()?Boolean.TRUE:Boolean.FALSE);
        } else {
            if (log.isDebugEnabled()) {
                if (session != null) {
                    log.debug(sm.getString(
                            "ReplicationValve.session.found", request.getContext().getName(),id));
                } else {
                    log.debug(sm.getString(
                            "ReplicationValve.session.invalid", request.getContext().getName(),id));
                }
            }
        }
    }
}
 
Example #18
Source File: UpdateValve.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
    if (getNext() == null) {
        return;
    }

    //check if we already filtered/processed this request 
    if (request.getNote(ALREADY_FILTERED_NOTE) == null) {
        request.setNote(ALREADY_FILTERED_NOTE, Boolean.TRUE);
        try {
            getNext().invoke(request, response);
        } finally {
            request.removeNote(ALREADY_FILTERED_NOTE);
            final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            try {
                ClassLoader applicationClassLoader = request.getContext().getLoader().getClassLoader();
                Thread.currentThread().setContextClassLoader(applicationClassLoader);
                Manager manager = request.getContext().getManager();
                ((RedissonSessionManager)manager).store(request.getSession(false));
            } finally {
                Thread.currentThread().setContextClassLoader(classLoader);
            }
        }
    } else {
        getNext().invoke(request, response);
    }
}
 
Example #19
Source File: JvmRouteBinderValve.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * get jvmroute from engine
 * 
 * @param request current request
 * @return return jvmRoute from ManagerBase or null
 */
protected String getLocalJvmRoute(Request request) {
    Manager manager = getManager(request);
    if(manager instanceof ManagerBase)
        return ((ManagerBase) manager).getJvmRoute();
    return null ;
}
 
Example #20
Source File: ReplicationValve.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 * 
 * @param request
 * @throws IOException
 */
protected void createPrimaryIndicator(Request request) throws IOException {
    String id = request.getRequestedSessionId();
    if ((id != null) && (id.length() > 0)) {
        Manager manager = request.getContext().getManager();
        Session session = manager.findSession(id);
        if (session instanceof ClusterSession) {
            ClusterSession cses = (ClusterSession) session;
            if (log.isDebugEnabled())
                log.debug(sm.getString(
                        "ReplicationValve.session.indicator", request.getContext().getName(),id,
                        primaryIndicatorName,
                        Boolean.valueOf(cses.isPrimarySession())));
            request.setAttribute(primaryIndicatorName, cses.isPrimarySession()?Boolean.TRUE:Boolean.FALSE);
        } else {
            if (log.isDebugEnabled()) {
                if (session != null) {
                    log.debug(sm.getString(
                            "ReplicationValve.session.found", request.getContext().getName(),id));
                } else {
                    log.debug(sm.getString(
                            "ReplicationValve.session.invalid", request.getContext().getName(),id));
                }
            }
        }
    }
}
 
Example #21
Source File: StandardSession.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a new Session associated with the specified Manager.
 *
 * @param manager The manager with which this Session is associated
 */
public StandardSession(Manager manager) {

    super();
    this.manager = manager;

    // Initialize access count
    if (ACTIVITY_CHECK) {
        accessCount = new AtomicInteger();
    }

}
 
Example #22
Source File: UpdateValve.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
    if (getNext() == null) {
        return;
    }

    //check if we already filtered/processed this request
    if (request.getNote(ALREADY_FILTERED_NOTE) == null) {
        request.setNote(ALREADY_FILTERED_NOTE, Boolean.TRUE);
        try {
            getNext().invoke(request, response);
        } finally {
            request.removeNote(ALREADY_FILTERED_NOTE);
            final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            try {
                ClassLoader applicationClassLoader = request.getContext().getLoader().getClassLoader();
                Thread.currentThread().setContextClassLoader(applicationClassLoader);
                Manager manager = request.getContext().getManager();
                ((RedissonSessionManager)manager).store(request.getSession(false));
            } finally {
                Thread.currentThread().setContextClassLoader(classLoader);
            }
        }
    } else {
        getNext().invoke(request, response);
    }
}
 
Example #23
Source File: HTMLManagerServlet.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected List<Session> getSessionsForName(ContextName cn,
        StringManager smClient) {
    if ((cn == null) || !(cn.getPath().startsWith("/") ||
            cn.getPath().equals(""))) {
        String path = null;
        if (cn != null) {
            path = cn.getPath();
        }
        throw new IllegalArgumentException(smClient.getString(
                "managerServlet.invalidPath",
                RequestUtil.filter(path)));
    }

    Context ctxt = (Context) host.findChild(cn.getName());
    if (null == ctxt) {
        throw new IllegalArgumentException(smClient.getString(
                "managerServlet.noContext",
                RequestUtil.filter(cn.getDisplayName())));
    }
    Manager manager = ctxt.getManager();
    List<Session> sessions = new ArrayList<Session>();
    sessions.addAll(Arrays.asList(manager.findSessions()));
    if (manager instanceof DistributedManager && showProxySessions) {
        // Add dummy proxy sessions
        Set<String> sessionIds =
            ((DistributedManager) manager).getSessionIdsFull();
        // Remove active (primary and backup) session IDs from full list
        for (Session session : sessions) {
            sessionIds.remove(session.getId());
        }
        // Left with just proxy sessions - add them
        for (String sessionId : sessionIds) {
            sessions.add(new DummyProxySession(sessionId));
        }
    }
    return sessions;
}
 
Example #24
Source File: StoreBase.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Set the Manager with which this Store is associated.
 *
 * @param manager The newly associated Manager
 */
@Override
public void setManager(Manager manager) {
    Manager oldManager = this.manager;
    this.manager = manager;
    support.firePropertyChange("manager", oldManager, this.manager);
}
 
Example #25
Source File: DatastoreValve.java    From tomcat-runtime with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>If the manager contain a store, use it to persist the session at the end of the request.</p>
 */
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {

  log.debug("Processing request with session:" + request.getRequestedSessionId());

  getNext().invoke(request, response);

  Context context = request.getContext();
  Manager manager = context.getManager();

  Session session = request.getSessionInternal(false);
  if (session != null && !isUriExcluded(request.getRequestURI())) {
    log.debug("Persisting session with id: " + session.getId());
    session.access();
    session.endAccess();

    if (manager instanceof StoreManager) {
      StoreManager storeManager = (StoreManager) manager;
      storeManager.getStore().save(session);
      storeManager.removeSuper(session);
    } else {
      log.error("In order to persist the session the manager must implement StoreManager");
    }
  } else {
    log.debug("Session not persisted (Non existent or the URI is ignored)");
  }

}
 
Example #26
Source File: ApplicationHttpRequest.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        Manager manager = context.getManager();
        if (manager == null)
            return (false);
        Session session = null;
        try {
            session = manager.findSession(requestedSessionId);
        } catch (IOException e) {
            // Ignore
        }
        if ((session != null) && session.isValid()) {
            return (true);
        } else {
            return (false);
        }

    } else {
        return super.isRequestedSessionIdValid();
    }
}
 
Example #27
Source File: SingleSignOn.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private void expire(SingleSignOnSessionKey key) {
    if (engine == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
        return;
    }
    Container host = engine.findChild(key.getHostName());
    if (host == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
        return;
    }
    Context context = (Context) host.findChild(key.getContextName());
    if (context == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
        return;
    }
    Manager manager = context.getManager();
    if (manager == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
        return;
    }
    Session session = null;
    try {
        session = manager.findSession(key.getSessionId());
    } catch (IOException e) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
        return;
    }
    if (session == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.sessionNotFound", key));
        return;
    }
    session.expire();
}
 
Example #28
Source File: ApplicationHttpRequest.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        Manager manager = context.getManager();
        if (manager == null)
            return (false);
        Session session = null;
        try {
            session = manager.findSession(requestedSessionId);
        } catch (IOException e) {
            // Ignore
        }
        if ((session != null) && session.isValid()) {
            return (true);
        } else {
            return (false);
        }

    } else {
        return super.isRequestedSessionIdValid();
    }
}
 
Example #29
Source File: CatalinaUserSessionManagement.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public void logoutHttpSessions(Manager sessionManager, List<String> sessionIds) {
    log.debug("logoutHttpSessions: " + sessionIds);

    for (String sessionId : sessionIds) {
        logoutSession(sessionManager, sessionId);
    }
}
 
Example #30
Source File: JvmRouteBinderValve.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * get jvmroute from engine
 * 
 * @param request current request
 * @return return jvmRoute from ManagerBase or null
 */
protected String getLocalJvmRoute(Request request) {
    Manager manager = getManager(request);
    if(manager instanceof ManagerBase)
        return ((ManagerBase) manager).getJvmRoute();
    return null ;
}