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

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

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

Context.setName介绍

暂无

代码示例

代码示例来源:origin: OryxProject/oryx

context.setName("Oryx");

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

context.addLifecycleListener(listener);
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());

代码示例来源:origin: apache/tomcat-maven-plugin

public Context addWebapp( Host host, String url, String name, String path )
  {

    Context ctx = new StandardContext();
    ctx.setName( name );
    ctx.setPath( url );
    ctx.setDocBase( path );

    ContextConfig ctxCfg = new ContextConfig();
    ctx.addLifecycleListener( ctxCfg );

    ctxCfg.setDefaultWebXml( new File( configurationDir, "conf/web.xml" ).getAbsolutePath() );

    if ( host == null )
    {
      getHost().addChild( ctx );
    }
    else
    {
      host.addChild( ctx );
    }

    return ctx;
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

context.addLifecycleListener(listener);
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());

代码示例来源:origin: apache/tomcat-maven-plugin

public Context addWebapp( Host host, String url, String name, String path )
  {

    Context ctx = new StandardContext();
    ctx.setName( name );
    ctx.setPath( url );
    ctx.setDocBase( path );

    ContextConfig ctxCfg = new ContextConfig();
    ctx.addLifecycleListener( ctxCfg );

    ctxCfg.setDefaultWebXml( new File( configurationDir, "conf/web.xml" ).getAbsolutePath() );

    if ( host == null )
    {
      getHost().addChild( ctx );
    }
    else
    {
      host.addChild( ctx );
    }

    return ctx;
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

context.addLifecycleListener(listener);
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

context.addLifecycleListener(listener);
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());

代码示例来源:origin: org.apache.tomcat.maven/tomcat7-war-runner

public Context addWebapp( Host host, String url, String name, String path )
  {
    Context ctx = new StandardContext();
    ctx.setName( name );
    ctx.setPath( url );
    ctx.setDocBase( path );
    ContextConfig ctxCfg = new ContextConfig();
    ctx.addLifecycleListener( ctxCfg );
    ctxCfg.setDefaultWebXml( new File( extractDirectory, "conf/web.xml" ).getAbsolutePath() );
    if ( host == null )
    {
      getHost().addChild( ctx );
    }
    else
    {
      host.addChild( ctx );
    }
    return ctx;
  }
};

代码示例来源:origin: apache/tomcat-maven-plugin

public Context addWebapp( Host host, String url, String name, String path )
  {
    Context ctx = new StandardContext();
    ctx.setName( name );
    ctx.setPath( url );
    ctx.setDocBase( path );
    ContextConfig ctxCfg = new ContextConfig();
    ctx.addLifecycleListener( ctxCfg );
    ctxCfg.setDefaultWebXml( new File( extractDirectory, "conf/web.xml" ).getAbsolutePath() );
    if ( host == null )
    {
      getHost().addChild( ctx );
    }
    else
    {
      host.addChild( ctx );
    }
    return ctx;
  }
};

代码示例来源:origin: apache/tomcat-maven-plugin

public Context addWebapp( Host host, String url, String name, String path )
  {
    Context ctx = new StandardContext();
    ctx.setName( name );
    ctx.setPath( url );
    ctx.setDocBase( path );
    ContextConfig ctxCfg = new ContextConfig();
    ctx.addLifecycleListener( ctxCfg );
    ctxCfg.setDefaultWebXml( new File( extractDirectory, "conf/web.xml" ).getAbsolutePath() );
    if ( host == null )
    {
      getHost().addChild( ctx );
    }
    else
    {
      host.addChild( ctx );
    }
    
    if (sessionManagerFactoryClassName != null) {
      boolean cookies = true;
      constructSessionManager(ctx, sessionManagerFactoryClassName, cookies);
    }
    return ctx;
  }
};

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

public Context addContext(Host host, String contextPath, String contextName,
    String dir) {
  silence(host, contextPath);
  Context ctx = new StandardContext();
  ctx.setName(contextName);
  ctx.setPath(contextPath);
  ctx.setDocBase(dir);
  ctx.addLifecycleListener(new FixContextListener());
  
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

public Context addContext(Host host, String contextPath, String contextName,
    String dir) {
  silence(host, contextPath);
  Context ctx = new StandardContext();
  ctx.setName(contextName);
  ctx.setPath(contextPath);
  ctx.setDocBase(dir);
  ctx.addLifecycleListener(new FixContextListener());
  
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @see #addContext(String, String)
 */
public Context addContext(Host host, String contextPath, String contextName,
    String dir) {
  silence(host, contextPath);
  Context ctx = new StandardContext();
  ctx.setName(contextName);
  ctx.setPath(contextPath);
  ctx.setDocBase(dir);
  ctx.addLifecycleListener(new FixContextListener());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @param host The host in which the context will be deployed
 * @param contextPath The context mapping to use, "" for root context.
 * @param contextName The context name
 * @param dir Base directory for the context, for static files.
 *  Must exist, relative to the server home
 * @return the deployed context
 * @see #addContext(String, String)
 */
public Context addContext(Host host, String contextPath, String contextName,
    String dir) {
  silence(host, contextName);
  Context ctx = createContext(host, contextPath);
  ctx.setName(contextName);
  ctx.setPath(contextPath);
  ctx.setDocBase(dir);
  ctx.addLifecycleListener(new FixContextListener());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @param host The host in which the context will be deployed
 * @param contextPath The context mapping to use, "" for root context.
 * @param contextName The context name
 * @param dir Base directory for the context, for static files.
 *  Must exist, relative to the server home
 * @return the deployed context
 * @see #addContext(String, String)
 */
public Context addContext(Host host, String contextPath, String contextName,
    String dir) {
  silence(host, contextName);
  Context ctx = createContext(host, contextPath);
  ctx.setName(contextName);
  ctx.setPath(contextPath);
  ctx.setDocBase(dir);
  ctx.addLifecycleListener(new FixContextListener());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

@Before
public void setupManager() {
  Context context = new StandardContext();
  Host host = new StandardHost();
  this.manager.setContext(context);
  context.setName("test-context-name");
  context.setParent(host);
  host.setName("test-host-name");
}

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

public Context addWebapp(Host host, String url, String name, String path) {
  silence(host, url);
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml(noDefaultWebXmlPath());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

@Override
public Context addWebapp(Host host, String url, String name, String path) {
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  URL configFile = getWebappConfigFile(path, url);
  ctx.setConfigFile(configFile);
  ContextConfig ctxCfg = new TomcatContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  if (host == null) {
    getHost().addChild(ctx);
  } 
  else {
    host.addChild(ctx);
  }
  return ctx;
}

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

public Context addWebapp(Host host, String url, String name, String path) {
  silence(host, url);
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml(noDefaultWebXmlPath());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

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

/**
 * @see #addWebapp(String, String)
 */
public Context addWebapp(Host host, String url, String name, String path) {
  silence(host, url);
  Context ctx = new StandardContext();
  ctx.setName(name);
  ctx.setPath(url);
  ctx.setDocBase(path);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  ctx.setConfigFile(getWebappConfigFile(path, url));
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml(noDefaultWebXmlPath());
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

相关文章

微信公众号

最新文章

更多

Context类方法