org.apache.catalina.Context.getManager()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.catalina.Context.getManager()方法的一些代码示例,展示了Context.getManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getManager()方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:getManager

Context.getManager介绍

[英]Return the Manager with which this Context is associated. If there is no associated Manager, return null.
[中]返回与此上下文关联的管理器。如果没有关联的管理器,则返回null

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public void lifecycleEvent(LifecycleEvent event) {
  if (event.getType().equals(Lifecycle.START_EVENT)) {
    Context context = (Context) event.getLifecycle();
    Manager manager = context.getManager();
    if (manager != null && manager instanceof StandardManager) {
      ((StandardManager) manager).setPathname(null);
    }
  }
}

代码示例来源:origin: apache/geode

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
 // Get the Manager
 Manager manager = request.getContext().getManager();
 // If it is an AbstractManager, handle possible failover
 if (manager instanceof DeltaSessionManager) {
  DeltaSessionManager absMgr = (DeltaSessionManager) manager;
  String localJvmRoute = absMgr.getJvmRoute();
  if (localJvmRoute != null) {
   handlePossibleFailover(request, absMgr, localJvmRoute);
  }
 }
 // Invoke the next Valve
 getNext().invoke(request, response);
}

代码示例来源:origin: redisson/redisson

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
  String sessionId = request.getRequestedSessionId();
  Session session = request.getContext().getManager().findSession(sessionId);
  if (session != null) {
    if (!session.isValid()) {
      session.expire();
      request.getContext().getManager().remove(session);
    } else {
      manager.add(session);
      session.access();
      session.endAccess();
    }
  }
  
  try {
    getNext().invoke(request, response);
  } finally {
    manager.store(request.getSession(false));
  }
}

代码示例来源:origin: org.springframework.boot/spring-boot

private void configureSession(Context context) {
  long sessionTimeout = getSessionTimeoutInMinutes();
  context.setSessionTimeout((int) sessionTimeout);
  Boolean httpOnly = getSession().getCookie().getHttpOnly();
  if (httpOnly != null) {
    context.setUseHttpOnly(httpOnly);
  }
  if (getSession().isPersistent()) {
    Manager manager = context.getManager();
    if (manager == null) {
      manager = new StandardManager();
      context.setManager(manager);
    }
    configurePersistSession(manager);
  }
  else {
    context.addLifecycleListener(new DisablePersistSessionListener());
  }
}

代码示例来源:origin: apache/geode

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
 Manager manager = request.getContext().getManager();
 DeltaSessionFacade session = null;

代码示例来源:origin: org.springframework.boot/spring-boot-actuator

private Manager findManager(ApplicationContext applicationContext) {
  if (applicationContext instanceof WebServerApplicationContext) {
    WebServer webServer = ((WebServerApplicationContext) applicationContext)
        .getWebServer();
    if (webServer instanceof TomcatWebServer) {
      Context context = findContext((TomcatWebServer) webServer);
      return context.getManager();
    }
  }
  return null;
}

代码示例来源:origin: psi-probe/psi-probe

@Override
protected ModelAndView handleContext(String contextName, Context context,
  HttpServletRequest request, HttpServletResponse response) throws Exception {
 String sid = ServletRequestUtils.getStringParameter(request, "sid");
 String attrName = ServletRequestUtils.getStringParameter(request, "attr");
 Session session = context.getManager().findSession(sid);
 if (session != null) {
  session.getSession().removeAttribute(attrName);
 }
 return new ModelAndView(new RedirectView(
   request.getContextPath() + getViewName() + "?" + request.getQueryString()));
}

代码示例来源:origin: psi-probe/psi-probe

@Override
protected ModelAndView handleContext(String contextName, Context context,
  HttpServletRequest request, HttpServletResponse response) throws Exception {
 String sessionId = ServletRequestUtils.getStringParameter(request, "sid");
 Session session = context.getManager().findSession(sessionId);
 if (session != null) {
  session.expire();
 }
 return new ModelAndView(new InternalResourceView(getViewName()));
}

代码示例来源:origin: psi-probe/psi-probe

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
  HttpServletResponse response) throws Exception {
 for (String sidWebApp : ServletRequestUtils.getStringParameters(request, "sid_webapp")) {
  if (sidWebApp != null) {
   String[] ss = sidWebApp.split(";");
   if (ss.length == 2) {
    String sessionId = ss[0];
    String appName = ss[1];
    Context context = getContainerWrapper().getTomcatContainer().findContext(appName);
    if (context != null) {
     Manager manager = context.getManager();
     Session session = manager.findSession(sessionId);
     if (session != null && session.isValid()) {
      session.expire();
     }
    } else {
     return new ModelAndView("errors/paramerror");
    }
   } else {
    return new ModelAndView("errors/paramerror");
   }
  }
 }
 return new ModelAndView(new InternalResourceView(getViewName()));
}

代码示例来源:origin: psi-probe/psi-probe

@Override
protected ModelAndView handleContext(String contextName, Context context,
  HttpServletRequest request, HttpServletResponse response) throws Exception {
 boolean privileged = SecurityUtils.hasAttributeValueRole(getServletContext(), request);
 boolean calcSize =
   privileged && ServletRequestUtils.getBooleanParameter(request, "size", false);
 String sid = ServletRequestUtils.getStringParameter(request, "sid");
 ApplicationSession appSession = ApplicationUtils
   .getApplicationSession(context.getManager().findSession(sid), calcSize, true);
 if (appSession != null) {
  appSession.setAllowedToViewValues(privileged);
  return new ModelAndView(getViewName(), "session", appSession);
 }
 return new ModelAndView(getViewName());
}

代码示例来源:origin: psi-probe/psi-probe

if (ctx != null && ctx.getManager() != null
  && (!searchInfo.isApply() || searchInfo.isUseSearch())) {
 Session[] sessions = ctx.getManager().findSessions();
 for (Session session : sessions) {
  ApplicationSession appSession =

代码示例来源:origin: psi-probe/psi-probe

logger.debug("collecting session information");
app.setSessionCount(context.getManager().findSessions().length);
long size = 0;
for (Session session : context.getManager().findSessions()) {
 ApplicationSession appSession = getApplicationSession(session, calcSize, false);
 if (appSession != null) {

代码示例来源:origin: org.glassfish.main.web/web-core

private boolean isSessionVersioningSupported() {
  return context != null &&
    context.getManager() != null &&
    context.getManager().isSessionVersioningSupported();
}

代码示例来源:origin: org.jboss.mod_cluster/mod_cluster

/**
* {@inheritDoc}
* @see org.jboss.modcluster.Context#getActiveSessionCount()
*/
public int getActiveSessionCount()
{
 return this.context.getManager().getActiveSessions();
}

代码示例来源:origin: org.jboss.mod_cluster/mod_cluster

/**
* {@inheritDoc}
* @see org.jboss.modcluster.Context#isDistributable()
*/
public boolean isDistributable()
{
 return this.context.getManager().getDistributable();
}

代码示例来源:origin: org.keycloak/keycloak-saml-tomcat-adapter-core

protected void logoutSessionIds(List<String> sessionIds) {
  if (sessionIds == null || sessionIds.isEmpty()) return;
  Manager sessionManager = request.getContext().getManager();
  sessionManagement.logoutHttpSessions(sessionManager, sessionIds);
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

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

相关文章

微信公众号

最新文章

更多

Context类方法