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

x33g5p2x  于2022-01-25 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(104)

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

Manager.getContext介绍

[英]Return the Context with which this Manager is associated.
[中]返回与此管理器关联的上下文。

代码示例

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Return the ServletContext to which this session belongs.
 */
@Override
public ServletContext getServletContext() {
  if (manager == null) {
    return null;
  }
  Context context = manager.getContext();
  return context.getServletContext();
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Return the ServletContext to which this session belongs.
 */
@Override
public ServletContext getServletContext() {
  if (manager == null) {
    return null;
  }
  Context context = manager.getContext();
  return context.getServletContext();
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Return the ServletContext to which this session belongs.
 */
@Override
public ServletContext getServletContext() {
  if (manager == null)
    return (null);
  Context context = manager.getContext();
  if (context == null)
    return (null);
  else
    return (context.getServletContext());
}

代码示例来源:origin: pivotalsoftware/session-managers

private String getContext() {
  String name = this.manager.getContext().getName();
  return name.startsWith("/") ? name : String.format("/%s", name);
}

代码示例来源:origin: pivotalsoftware/session-managers

private String getObjectName() {
  String contextPath = getContext();
  String hostName = this.manager.getContext().getParent().getName();
  return String.format("Catalina:type=Store,context=%s,host=%s,name=%s", contextPath, hostName,
      getClass().getSimpleName());
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

@Override
public String getManagerName(String name, Manager manager) {
  String clusterName = name ;
  if (clusterName == null) clusterName = manager.getContext().getName();
  if (getContainer() instanceof Engine) {
    Context context = manager.getContext();
    Container host = context.getParent();
    if (host instanceof Host && clusterName != null &&
        !(clusterName.startsWith(host.getName() +"#"))) {
      clusterName = host.getName() +"#" + clusterName ;
    }
  }
  return clusterName;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the JNDI name of a DataSource-factory to use for db access
 *
 * @param dataSourceName The JNDI name of the DataSource-factory
 */
public void setDataSourceName(String dataSourceName) {
  if (dataSourceName == null || "".equals(dataSourceName.trim())) {
    manager.getContext().getLogger().warn(
        sm.getString(getStoreName() + ".missingDataSourceName"));
    return;
  }
  this.dataSourceName = dataSourceName;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Set the JNDI name of a DataSource-factory to use for db access
 *
 * @param dataSourceName The JNDI name of the DataSource-factory
 */
public void setDataSourceName(String dataSourceName) {
  if (dataSourceName == null || "".equals(dataSourceName.trim())) {
    manager.getContext().getLogger().warn(
        sm.getString(getStoreName() + ".missingDataSourceName"));
    return;
  }
  this.dataSourceName = dataSourceName;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Set the JNDI name of a DataSource-factory to use for db access
 *
 * @param dataSourceName The JNDI name of the DataSource-factory
 */
public void setDataSourceName(String dataSourceName) {
  if (dataSourceName == null || "".equals(dataSourceName.trim())) {
    manager.getContext().getLogger().warn(
        sm.getString(getStoreName() + ".missingDataSourceName"));
    return;
  }
  this.dataSourceName = dataSourceName;
}

代码示例来源:origin: com.github.jkutner/tomcat-redis-session

@Override
public void setManager(Manager manager) {
  log.trace(String.format("EXEC setId(%s);", manager));
  this.manager = (RedisManager) manager;
  this.pool = this.manager.getPool();
  this.servletContext = manager.getContext().getServletContext();
  this.disableListeners = this.manager.isDisableListeners();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * 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
 */
@Override
public void remove(String id) throws IOException {
  File file = file(id);
  if (file == null) {
    return;
  }
  if (manager.getContext().getLogger().isDebugEnabled()) {
    manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".removing",
             id, file.getAbsolutePath()));
  }
  if (file.exists() && !file.delete()) {
    throw new IOException(sm.getString("fileStore.deleteSessionFailed", file));
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Send all changed cross context sessions to backups
 */
protected void sendCrossContextSession() {
  List<DeltaSession> sessions = crossContextSessions.get();
  if(sessions != null && sessions.size() >0) {
    for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
      Session session = iter.next();
      if(log.isDebugEnabled()) {
        log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",
            session.getManager().getContext().getName() ));
      }
      sendMessage(session,(ClusterManager)session.getManager());
      if(doStatistics()) {
        nrOfCrossContextSendRequests++;
      }
    }
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Register all cross context sessions inside endAccess.
 * Use a list with contains check, that the Portlet API can include a lot of fragments from same or
 * different applications with session changes.
 *
 * @param session cross context session
 */
public void registerReplicationSession(DeltaSession session) {
  List<DeltaSession> sessions = crossContextSessions.get();
  if(sessions != null) {
    if(!sessions.contains(session)) {
      if(log.isDebugEnabled()) {
        log.debug(sm.getString("ReplicationValve.crossContext.registerSession",
          session.getIdInternal(),
          session.getManager().getContext().getName()));
      }
      sessions.add(session);
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

public SingleSignOnSessionKey(Session session) {
  this.sessionId = session.getId();
  Context context = session.getManager().getContext();
  this.contextName = context.getName();
  this.hostName = context.getParent().getName();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

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

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

public SingleSignOnSessionKey(Session session) {
  this.sessionId = session.getId();
  Context context = session.getManager().getContext();
  this.contextName = context.getName();
  this.hostName = context.getParent().getName();
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * Send all changed cross context sessions to backups
 */
protected void sendCrossContextSession() {
  List<DeltaSession> sessions = crossContextSessions.get();
  if(sessions != null && sessions.size() >0) {
    for (DeltaSession session : sessions) {
      if(log.isDebugEnabled()) {
        log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",
            session.getManager().getContext().getName() ));
      }
      sendMessage(session,(ClusterManager)session.getManager());
      if(doStatistics()) {
        nrOfCrossContextSendRequests++;
      }
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * Reset DeltaRequest from session
 * @param session HttpSession from current request or cross context session
 */
protected void resetDeltaRequest(Session session) {
  if(log.isDebugEnabled()) {
    log.debug(sm.getString("ReplicationValve.resetDeltaRequest" ,
      session.getManager().getContext().getName() ));
  }
  ((DeltaSession)session).resetDeltaRequest();
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Reset DeltaRequest from session
 * @param session HttpSession from current request or cross context session
 */
protected void resetDeltaRequest(Session session) {
  if(log.isDebugEnabled()) {
    log.debug(sm.getString("ReplicationValve.resetDeltaRequest" ,
      session.getManager().getContext().getName() ));
  }
  ((DeltaSession)session).resetDeltaRequest();
}

代码示例来源:origin: pivotalsoftware/session-managers

@Test
public void initInternal() {
  SessionFlushValve valve = new SessionFlushValve();
  StandardContext context = (StandardContext) this.manager.getContext();
  context.addValve(new RemoteIpValve());
  context.addValve(valve);
  this.store.setManager(this.manager);
  this.store.initInternal();
  assertSame(this.store, valve.getStore());
}

相关文章