本文整理汇总了Java中org.apache.catalina.deploy.ContextEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java ContextEnvironment类的具体用法?Java ContextEnvironment怎么用?Java ContextEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextEnvironment类属于org.apache.catalina.deploy包,在下文中一共展示了ContextEnvironment类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:NamingResourcesMBean.java
示例2: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static DynamicMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:30,代码来源:MBeanUtils.java
示例3: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:MBeanUtils.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();
// 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
示例5: testBug53465
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
@Test
public void testBug53465() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.enableNaming();
File appDir =
new File("test/webapp-3.0");
// app dir is relative to server home
org.apache.catalina.Context ctxt =
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
tomcat.start();
ByteChunk bc = new ByteChunk();
int rc = getUrl("http://localhost:" + getPort() +
"/test/bug5nnnn/bug53465.jsp", bc, null);
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
Assert.assertTrue(bc.toString().contains("<p>10</p>"));
ContextEnvironment ce =
ctxt.getNamingResources().findEnvironment("bug53465");
Assert.assertEquals("Bug53465MappedName", ce.getProperty("mappedName"));
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:TestNamingContext.java
示例6: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:NamingResourcesMBean.java
示例7: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = getNamingResources().findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:StandardContextMBean.java
示例8: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
static DynamicMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:MBeanUtils.java
示例9: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:MBeanUtils.java
示例10: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
throw new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:22,代码来源:NamingResourcesMBean.java
示例11: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = getNamingResources().findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
throw new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:21,代码来源:StandardContextMBean.java
示例12: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static ModelMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ModelMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
mserver.registerMBean(mbean, oname);
return (mbean);
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:27,代码来源:MBeanUtils.java
示例13: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
mserver.unregisterMBean(oname);
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:24,代码来源:MBeanUtils.java
示例14: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for this
* web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = ((NamingResources) this.resource).findEnvironments();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException(
"Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:NamingResourcesMBean.java
示例15: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment
* The ContextEnvironment to be managed
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with " + mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if (mserver.isRegistered(oname)) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
开发者ID:how2j,项目名称:lazycat,代码行数:31,代码来源:MBeanUtils.java
示例16: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this <code>ContextEnvironment</code> object.
*
* @param environment
* The ContextEnvironment to be managed
*
* @exception Exception
* if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextEnvironment environment) throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
开发者ID:how2j,项目名称:lazycat,代码行数:25,代码来源:MBeanUtils.java
示例17: createObjectName
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>Service</code> object.
*
* @param domain Domain in which this name is to be created
* @param environment The ContextEnvironment to be named
*
* @exception MalformedObjectNameException if a name cannot be created
*/
public static ObjectName createObjectName(String domain,
ContextEnvironment environment)
throws MalformedObjectNameException {
ObjectName name = null;
Object container =
environment.getNamingResources().getContainer();
if (container instanceof Server) {
name = new ObjectName(domain + ":type=Environment" +
",resourcetype=Global,name=" + environment.getName());
} else if (container instanceof Context) {
Context context = ((Context)container);
ContextName cn = new ContextName(context.getName(), false);
Container host = context.getParent();
name = new ObjectName(domain + ":type=Environment" +
",resourcetype=Context,context=" + cn.getDisplayName() +
",host=" + host.getName() +
",name=" + environment.getName());
}
return (name);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:32,代码来源:MBeanUtils.java
示例18: 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
示例19: 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
注:本文中的org.apache.catalina.deploy.ContextEnvironment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论