当前位置: 首页>>代码示例>>Java>>正文


Java ContextEnvironment.setValue方法代码示例

本文整理汇总了Java中org.apache.catalina.deploy.ContextEnvironment.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java ContextEnvironment.setValue方法的具体用法?Java ContextEnvironment.setValue怎么用?Java ContextEnvironment.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.deploy.ContextEnvironment的用法示例。


在下文中一共展示了ContextEnvironment.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBug49132

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test JNDI is available to ServletContextListeners.
 */
@Test
public void testBug49132() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    org.apache.catalina.Context ctx = tomcat.addContext("", null);

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType(BUG49132_VALUE.getClass().getName());
    environment.setName(BUG49132_NAME);
    environment.setValue(BUG49132_VALUE);
    ctx.getNamingResources().addEnvironment(environment);

    ctx.addApplicationListener(Bug49132Listener.class.getName());

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:TestNamingContextListener.java

示例2: testBug49132

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test JNDI is available to ServletContextListeners.
 */
@Test
public void testBug49132() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType(BUG49132_VALUE.getClass().getName());
    environment.setName(BUG49132_NAME);
    environment.setValue(BUG49132_VALUE);
    ctx.getNamingResources().addEnvironment(environment);

    ctx.addApplicationListener(new ApplicationListener(
            Bug49132Listener.class.getName(), false));

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:28,代码来源:TestNamingContextListener.java

示例3: testBug49132

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test JNDI is available to ServletContextListeners.
 */
@Test
public void testBug49132() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType(BUG49132_VALUE.getClass().getName());
    environment.setName(BUG49132_NAME);
    environment.setValue(BUG49132_VALUE);
    ctx.getNamingResources().addEnvironment(environment);

    ctx.addApplicationListener(Bug49132Listener.class.getName());

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:27,代码来源:TestNamingContextListener.java

示例4: testBug49132

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/** 
 * Test JNDI is available to ServletContextListeners.
 */
@Test
public void testBug49132() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    
    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx = 
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));
    
    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType(JNDI_VALUE.getClass().getName());
    environment.setName(JNDI_NAME);
    environment.setValue(JNDI_VALUE);
    ctx.getNamingResources().addEnvironment(environment);
    
    ctx.addApplicationListener(Bug49132Listener.class.getName());
    
    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:27,代码来源:TestNamingContextListener.java

示例5: testEnableNaming

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test for enabling JNDI.
 */
@Test
public void testEnableNaming() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    Context ctx = tomcat.addContext("", null);

    // You can customise the context by calling its API

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName(HelloWorldJndi.JNDI_ENV_NAME);
    environment.setValue("Tomcat User");
    ctx.getNamingResources().addEnvironment(environment);

    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:30,代码来源:TestTomcat.java

示例6: testEnableNamingGlobal

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test for enabling JNDI and using global resources.
 */
@Test
public void testEnableNamingGlobal() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    Context ctx = tomcat.addContext("", null);

    // You can customise the context by calling its API

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName("globalTest");
    environment.setValue("Tomcat User");
    tomcat.getServer().getGlobalNamingResources().addEnvironment(environment);

    ContextResourceLink link = new ContextResourceLink();
    link.setGlobal("globalTest");
    link.setName(HelloWorldJndi.JNDI_ENV_NAME);
    link.setType("java.lang.String");
    ctx.getNamingResources().addResourceLink(link);

    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:TestTomcat.java

示例7: testBug54096

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
@Test
public void testBug54096() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    org.apache.catalina.Context ctx = tomcat.addContext("", null);

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environmentA = new ContextEnvironment();
    environmentA.setType(Bug54096EnvA.class.getName());
    environmentA.setName(BUG54096_NameA);
    environmentA.setValue(BUG54096_ValueA);
    ctx.getNamingResources().addEnvironment(environmentA);

    ContextEnvironment environmentB = new ContextEnvironment();
    environmentB.setType(Bug54096EnvB.class.getName());
    environmentB.setName(BUG54096_NameB);
    environmentB.setValue(BUG54096_ValueB);
    ctx.getNamingResources().addEnvironment(environmentB);

    ctx.addApplicationListener(Bug54096Listener.class.getName());

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:TestNamingContextListener.java

示例8: testBug52830

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
@Test
public void testBug52830() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // No file system docBase required
    StandardContext ctx = (StandardContext) tomcat.addContext("", null);

    // Create the resource
    ContextEnvironment env = new ContextEnvironment();
    env.setName("boolean");
    env.setType(Boolean.class.getName());
    env.setValue("true");
    ctx.getNamingResources().addEnvironment(env);

    // Map the test Servlet
    Bug52830Servlet bug52830Servlet = new Bug52830Servlet();
    Tomcat.addServlet(ctx, "bug52830Servlet", bug52830Servlet);
    ctx.addServletMapping("/", "bug52830Servlet");

    tomcat.start();

    ByteChunk bc = new ByteChunk();
    int rc = getUrl("http://localhost:" + getPort() + "/", bc, null);
    assertEquals(200, rc);
    assertTrue(bc.toString().contains("truetrue"));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:TestNamingContext.java

示例9: testEnableNaming

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test for enabling JNDI.
 */
@Test
public void testEnableNaming() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // You can customise the context by calling its API

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName(HelloWorldJndi.JNDI_ENV_NAME);
    environment.setValue("Tomcat User");
    ctx.getNamingResources().addEnvironment(environment);

    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:31,代码来源:TestTomcat.java

示例10: testEnableNamingGlobal

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/**
 * Test for enabling JNDI and using global resources.
 */
@Test
public void testEnableNamingGlobal() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // You can customise the context by calling its API

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName("globalTest");
    environment.setValue("Tomcat User");
    tomcat.getServer().getGlobalNamingResources().addEnvironment(environment);

    ContextResourceLink link = new ContextResourceLink();
    link.setGlobal("globalTest");
    link.setName(HelloWorldJndi.JNDI_ENV_NAME);
    ctx.getNamingResources().addResourceLink(link);

    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:36,代码来源:TestTomcat.java

示例11: testBug54096

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
@Test
public void testBug54096() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environmentA = new ContextEnvironment();
    environmentA.setType(Bug54096EnvA.class.getName());
    environmentA.setName(BUG54096_NameA);
    environmentA.setValue(BUG54096_ValueA);
    ctx.getNamingResources().addEnvironment(environmentA);

    ContextEnvironment environmentB = new ContextEnvironment();
    environmentB.setType(Bug54096EnvB.class.getName());
    environmentB.setName(BUG54096_NameB);
    environmentB.setValue(BUG54096_ValueB);
    ctx.getNamingResources().addEnvironment(environmentB);

    ctx.addApplicationListener(new ApplicationListener(
            Bug54096Listener.class.getName(), false));

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:31,代码来源:TestNamingContextListener.java

示例12: testBug52830

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
@Test
public void testBug52830() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // Must have a real docBase - just use temp
    StandardContext ctx = (StandardContext)
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // Create the resource
    ContextEnvironment env = new ContextEnvironment();
    env.setName("boolean");
    env.setType(Boolean.class.getName());
    env.setValue("true");
    ctx.getNamingResources().addEnvironment(env);

    // Map the test Servlet
    Bug52830Servlet bug52830Servlet = new Bug52830Servlet();
    Tomcat.addServlet(ctx, "bug52830Servlet", bug52830Servlet);
    ctx.addServletMapping("/", "bug52830Servlet");

    tomcat.start();

    ByteChunk bc = new ByteChunk();
    int rc = getUrl("http://localhost:" + getPort() + "/", bc, null);
    assertEquals(200, rc);
    assertTrue(bc.toString().contains("truetrue"));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:29,代码来源:TestNamingContext.java

示例13: testBug54096

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
@Test
public void testBug54096() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx =
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));

    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environmentA = new ContextEnvironment();
    environmentA.setType(Bug54096EnvA.class.getName());
    environmentA.setName(BUG54096_NameA);
    environmentA.setValue(BUG54096_ValueA);
    ctx.getNamingResources().addEnvironment(environmentA);

    ContextEnvironment environmentB = new ContextEnvironment();
    environmentB.setType(Bug54096EnvB.class.getName());
    environmentB.setName(BUG54096_NameB);
    environmentB.setValue(BUG54096_ValueB);
    ctx.getNamingResources().addEnvironment(environmentB);

    ctx.addApplicationListener(Bug54096Listener.class.getName());

    tomcat.start();

    assertEquals(LifecycleState.STARTED, ctx.getState());
}
 
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:30,代码来源:TestNamingContextListener.java

示例14: testEnableNaming

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/** 
 * Test for enabling JNDI.
 */
@Test
public void testEnableNaming() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    
    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx = 
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));
    
    // You can customise the context by calling its API
    
    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName(HelloWorldJndi.JNDI_ENV_NAME);
    environment.setValue("Tomcat User");
    ctx.getNamingResources().addEnvironment(environment);
    
    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");
    
    tomcat.start();
    
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:31,代码来源:TestTomcat.java

示例15: testEnableNamingGlobal

import org.apache.catalina.deploy.ContextEnvironment; //导入方法依赖的package包/类
/** 
 * Test for enabling JNDI and using global resources.
 */
@Test
public void testEnableNamingGlobal() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    
    // Must have a real docBase - just use temp
    org.apache.catalina.Context ctx = 
        tomcat.addContext("", System.getProperty("java.io.tmpdir"));
    
    // You can customise the context by calling its API
    
    // Enable JNDI - it is disabled by default
    tomcat.enableNaming();

    ContextEnvironment environment = new ContextEnvironment();
    environment.setType("java.lang.String");
    environment.setName("globalTest");
    environment.setValue("Tomcat User");
    tomcat.getServer().getGlobalNamingResources().addEnvironment(environment);
    
    ContextResourceLink link = new ContextResourceLink();
    link.setGlobal("globalTest");
    link.setName(HelloWorldJndi.JNDI_ENV_NAME);
    ctx.getNamingResources().addResourceLink(link);
    
    Tomcat.addServlet(ctx, "jndiServlet", new HelloWorldJndi());
    ctx.addServletMapping("/", "jndiServlet");
    
    tomcat.start();
    
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("Hello, Tomcat User", res.toString());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:36,代码来源:TestTomcat.java


注:本文中的org.apache.catalina.deploy.ContextEnvironment.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。