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

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

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

Context.getParent介绍

暂无

代码示例

代码示例来源:origin: magro/memcached-session-manager

protected MemcachedNodesManager createMemcachedNodesManager(final String memcachedNodes, final String failoverNodes) {
  final Context context = _manager.getContext();
  final String webappVersion = Reflections.invoke(context, "getWebappVersion", null);
  final StorageKeyFormat storageKeyFormat = StorageKeyFormat.of(_storageKeyPrefix, context.getParent().getName(), context.getName(), webappVersion);
  return MemcachedNodesManager.createFor( memcachedNodes, failoverNodes, storageKeyFormat, _storageClientCallback);
}

代码示例来源:origin: magro/memcached-session-manager

@BeforeMethod
public void setUp() throws Exception {
  _service = mock( MemcachedSessionService.class );
  _request = mock( Request.class );
  _response = mock( Response.class );
  final Context _contextContainer = mock(Context.class);
  final Host _hostContainer = mock(Host.class);
  final SessionManager _manager = mock(SessionManager.class);
  when(_service.getManager()).thenReturn(_manager);
  when(_manager.getContext()).thenReturn(_contextContainer);
  when(_contextContainer.getParent()).thenReturn(_hostContainer);
  when(_contextContainer.getPath()).thenReturn("/");
  _sessionTrackerValve = createSessionTrackerValve();
  _nextValve = mock( Valve.class );
  _sessionTrackerValve.setNext( _nextValve );
  _sessionTrackerValve.setContainer(_hostContainer);
  when(_request.getRequestURI()).thenReturn( "/someRequest");
  when(_request.getMethod()).thenReturn("GET");
  when(_request.getQueryString()).thenReturn(null);
  when(_request.getContext()).thenReturn(_contextContainer);
  when(_request.getNote(eq(RequestTrackingHostValve.REQUEST_PROCESSED))).thenReturn(Boolean.TRUE);
  when(_request.getNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED))).thenReturn(Boolean.FALSE);
}

代码示例来源:origin: magro/memcached-session-manager

_trackingHostValve = createRequestTrackingHostValve(sessionCookieName, _currentRequest);
final Context context = _manager.getContext();
context.getParent().getPipeline().addValve(_trackingHostValve);
_trackingContextValve = createRequestTrackingContextValve(sessionCookieName);
context.getPipeline().addValve( _trackingContextValve );

代码示例来源:origin: magro/memcached-session-manager

public void shutdown() {
  _log.info( "Stopping services." );
  _manager.getContext().getParent().getPipeline().removeValve(_trackingHostValve);
  _manager.getContext().getPipeline().removeValve(_trackingContextValve);
  _backupSessionService.shutdown();
  if ( _lockingStrategy != null ) {
    _lockingStrategy.shutdown();
  }
  if ( _storage != null ) {
    _storage.shutdown();
    _storage = null;
  }
  _transcoderFactory = null;
  _invalidSessionsCache.clear();
}

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

protected File getHostConfigBase() {
  File file = null;
  if (context.getParent() instanceof Host) {
    file = ((Host)context.getParent()).getConfigBaseFile();
  }
  return file;
}

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

protected File getHostConfigBase() {
  File file = null;
  if (context.getParent() instanceof Host) {
    file = ((Host)context.getParent()).getConfigBaseFile();
  }
  return file;
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat

/**
* Traverse the parent chain of the context to reach the Catalina Engine
* @param context Context of the web application
* @return
*/
private Engine getCatalinaEngine(org.apache.catalina.Context context)
{
 Container parentContainer = context.getParent();
 while(parentContainer != null && !(parentContainer instanceof Engine))
   parentContainer = parentContainer.getParent();
 return (Engine) parentContainer;
}

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

private static File engineBase(final Context standardContext) {
  final String base = System.getProperty(Globals.CATALINA_BASE_PROP);
  if( base == null ) {
    final StandardEngine eng = (StandardEngine) standardContext.getParent().getParent();
    return eng.getCatalinaBase();
  }
  return new File(base);
}

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

protected String getBaseDir() {
  Container engineC=context.getParent().getParent();
  if( engineC instanceof StandardEngine ) {
    return ((StandardEngine)engineC).getBaseDir();
  }
  return System.getProperty("catalina.base");
}

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

protected String getBaseDir() {
  Container engineC=context.getParent().getParent();
  if( engineC instanceof StandardEngine ) {
    return ((StandardEngine)engineC).getBaseDir();
  }
  return System.getProperty(Globals.CATALINA_BASE_PROP);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

protected String getBaseDir() {
  Container engineC=context.getParent().getParent();
  if( engineC instanceof StandardEngine ) {
    return ((StandardEngine)engineC).getBaseDir();
  }
  return System.getProperty(Globals.CATALINA_BASE_PROP);
}

代码示例来源:origin: tomcat/catalina

protected String getBaseDir() {
  Container engineC=context.getParent().getParent();
  if( engineC instanceof StandardEngine ) {
    return ((StandardEngine)engineC).getBaseDir();
  }
  return System.getProperty("catalina.base");
}

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

@Override
public String getHostName() {
  if (resources != null) {
    Container host = resources.getContext().getParent();
    if (host != null) {
      return host.getName();
    }
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private javax.naming.Context getGlobalNamingContext() {
  if (container instanceof Context) {
    Engine e = (Engine) ((Context) container).getParent().getParent();
    return e.getService().getServer().getGlobalNamingContext();
  }
  return null;
}

代码示例来源: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: stackoverflow.com

Context context = (Context) wrapper.getParent();
 Host currentHost = (Host) context.getParent();
 Engine engine = (Engine) currentHost.getParent();
 StandardHost host = new StandardHost();
 host.setAppBase(appBase);
 host.setName(domainName);
 engine.addChild(host);

代码示例来源:origin: org.mobicents.arquillian.container/mss-tomcat-embedded-6

@Override
public synchronized void removeContext(Context context) {
  if( log.isDebugEnabled() )
    log.debug("Removing context[" + context.getPath() + "]");
  boolean isContextExists = isContextExists(context);
  if(!isContextExists)
    return;
  
  // Remove this Context from the associated Host
  if( log.isDebugEnabled() )
    log.debug(" Removing this Context");
  context.getParent().removeChild(context);
}

相关文章

微信公众号

最新文章

更多

Context类方法